80
80
* @author Marc Vanbrabant
81
81
* @author Anton Naydenov
82
82
* @author vdisk
83
+ * @author Junghoon Ban
83
84
* @since 3.2
84
85
*/
85
86
public class MappingElasticsearchConverter
@@ -116,8 +117,8 @@ public MappingElasticsearchConverter(
116
117
@ Override
117
118
public void setApplicationContext (ApplicationContext applicationContext ) throws BeansException {
118
119
119
- if (mappingContext instanceof ApplicationContextAware ) {
120
- (( ApplicationContextAware ) mappingContext ) .setApplicationContext (applicationContext );
120
+ if (mappingContext instanceof ApplicationContextAware contextAware ) {
121
+ contextAware .setApplicationContext (applicationContext );
121
122
}
122
123
}
123
124
@@ -503,16 +504,16 @@ TypeInformation<?> getCollectionComponentType(TypeInformation<?> type) {
503
504
private Object propertyConverterRead (ElasticsearchPersistentProperty property , Object source ) {
504
505
PropertyValueConverter propertyValueConverter = Objects .requireNonNull (property .getPropertyValueConverter ());
505
506
506
- if (source instanceof String []) {
507
+ if (source instanceof String [] strings ) {
507
508
// convert to a List
508
- source = Arrays .asList (( String []) source );
509
+ source = Arrays .asList (strings );
509
510
}
510
511
511
- if (source instanceof List ) {
512
- source = (( List <?>) source ) .stream ().map (it -> convertOnRead (propertyValueConverter , it ))
512
+ if (source instanceof List <?> list ) {
513
+ source = list .stream ().map (it -> convertOnRead (propertyValueConverter , it ))
513
514
.collect (Collectors .toList ());
514
- } else if (source instanceof Set ) {
515
- source = (( Set <?>) source ) .stream ().map (it -> convertOnRead (propertyValueConverter , it ))
515
+ } else if (source instanceof Set <?> set ) {
516
+ source = set .stream ().map (it -> convertOnRead (propertyValueConverter , it ))
516
517
.collect (Collectors .toSet ());
517
518
} else {
518
519
source = convertOnRead (propertyValueConverter , source );
@@ -1186,8 +1187,8 @@ protected Map<String, Object> createMap(Map<?, ?> map, ElasticsearchPersistentPr
1186
1187
*/
1187
1188
private static Collection <?> asCollection (Object source ) {
1188
1189
1189
- if (source instanceof Collection ) {
1190
- return ( Collection <?>) source ;
1190
+ if (source instanceof Collection <?> collection ) {
1191
+ return collection ;
1191
1192
}
1192
1193
1193
1194
return source .getClass ().isArray () ? CollectionUtils .arrayToList (source ) : Collections .singleton (source );
@@ -1201,9 +1202,9 @@ public void updateQuery(Query query, @Nullable Class<?> domainClass) {
1201
1202
1202
1203
Assert .notNull (query , "query must not be null" );
1203
1204
1204
- if (query instanceof BaseQuery ) {
1205
+ if (query instanceof BaseQuery baseQuery ) {
1205
1206
1206
- if ((( BaseQuery ) query ) .queryIsUpdatedByConverter ()) {
1207
+ if (baseQuery .queryIsUpdatedByConverter ()) {
1207
1208
return ;
1208
1209
}
1209
1210
}
@@ -1214,12 +1215,12 @@ public void updateQuery(Query query, @Nullable Class<?> domainClass) {
1214
1215
1215
1216
updatePropertiesInFieldsAndSourceFilter (query , domainClass );
1216
1217
1217
- if (query instanceof CriteriaQuery ) {
1218
- updatePropertiesInCriteriaQuery (( CriteriaQuery ) query , domainClass );
1218
+ if (query instanceof CriteriaQuery criteriaQuery ) {
1219
+ updatePropertiesInCriteriaQuery (criteriaQuery , domainClass );
1219
1220
}
1220
1221
1221
- if (query instanceof BaseQuery ) {
1222
- (( BaseQuery ) query ) .setQueryIsUpdatedByConverter (true );
1222
+ if (query instanceof BaseQuery baseQuery ) {
1223
+ baseQuery .setQueryIsUpdatedByConverter (true );
1223
1224
}
1224
1225
}
1225
1226
0 commit comments