53
53
import org .springframework .data .mapping .PersistentPropertyAccessor ;
54
54
import org .springframework .data .mapping .SimplePropertyHandler ;
55
55
import org .springframework .data .mapping .context .MappingContext ;
56
- import org .springframework .data .mapping .model .*;
57
- import org .springframework .data .util .ClassTypeInformation ;
56
+ import org .springframework .data .mapping .model .ConvertingPropertyAccessor ;
57
+ import org .springframework .data .mapping .model .DefaultSpELExpressionEvaluator ;
58
+ import org .springframework .data .mapping .model .EntityInstantiator ;
59
+ import org .springframework .data .mapping .model .EntityInstantiators ;
60
+ import org .springframework .data .mapping .model .ParameterValueProvider ;
61
+ import org .springframework .data .mapping .model .PersistentEntityParameterValueProvider ;
62
+ import org .springframework .data .mapping .model .PropertyValueProvider ;
63
+ import org .springframework .data .mapping .model .SpELContext ;
64
+ import org .springframework .data .mapping .model .SpELExpressionEvaluator ;
65
+ import org .springframework .data .mapping .model .SpELExpressionParameterValueProvider ;
58
66
import org .springframework .data .util .TypeInformation ;
59
67
import org .springframework .format .datetime .DateFormatterRegistrar ;
60
68
import org .springframework .lang .Nullable ;
@@ -213,7 +221,7 @@ public Reader(
213
221
@ SuppressWarnings ("unchecked" )
214
222
<R > R read (Class <R > type , Document source ) {
215
223
216
- TypeInformation <R > typeHint = ClassTypeInformation . from ((Class <R >) ClassUtils .getUserClass (type ));
224
+ TypeInformation <R > typeHint = TypeInformation . of ((Class <R >) ClassUtils .getUserClass (type ));
217
225
R r = read (typeHint , source );
218
226
219
227
if (r == null ) {
@@ -244,7 +252,7 @@ private <R> R read(TypeInformation<R> type, Map<String, Object> source) {
244
252
return readMap (typeToUse , source );
245
253
}
246
254
247
- if (typeToUse .equals (ClassTypeInformation .OBJECT )) {
255
+ if (typeToUse .equals (TypeInformation .OBJECT )) {
248
256
return (R ) source ;
249
257
}
250
258
// Retrieve persistent entity info
@@ -286,13 +294,13 @@ private <R> R readMap(TypeInformation<?> type, Map<String, Object> source) {
286
294
}
287
295
288
296
Object value = entry .getValue ();
289
- TypeInformation <?> defaultedValueType = valueType != null ? valueType : ClassTypeInformation .OBJECT ;
297
+ TypeInformation <?> defaultedValueType = valueType != null ? valueType : TypeInformation .OBJECT ;
290
298
291
299
if (value instanceof Map ) {
292
300
map .put (key , read (defaultedValueType , (Map <String , Object >) value ));
293
301
} else if (value instanceof List ) {
294
302
map .put (key ,
295
- readCollectionOrArray (valueType != null ? valueType : ClassTypeInformation .LIST , (List <Object >) value ));
303
+ readCollectionOrArray (valueType != null ? valueType : TypeInformation .LIST , (List <Object >) value ));
296
304
} else {
297
305
map .put (key , getPotentiallyConvertedSimpleRead (value , rawValueType ));
298
306
}
@@ -397,7 +405,7 @@ protected <R> R readProperties(ElasticsearchPersistentEntity<?> entity, R instan
397
405
398
406
for (ElasticsearchPersistentProperty prop : entity ) {
399
407
400
- if (entity .isConstructorArgument (prop ) || !prop .isReadable ()) {
408
+ if (entity .isCreatorArgument (prop ) || !prop .isReadable ()) {
401
409
continue ;
402
410
}
403
411
@@ -504,7 +512,7 @@ private Object readCollectionOrArray(TypeInformation<?> targetType, Collection<?
504
512
505
513
TypeInformation <?> componentType = targetType .getComponentType () != null //
506
514
? targetType .getComponentType () //
507
- : ClassTypeInformation .OBJECT ;
515
+ : TypeInformation .OBJECT ;
508
516
Class <?> rawComponentType = componentType .getType ();
509
517
510
518
Collection <Object > items = targetType .getType ().isArray () //
@@ -649,7 +657,8 @@ public ConverterAwareSpELExpressionParameterValueProvider(SpELExpressionEvaluato
649
657
* @see org.springframework.data.mapping.model.SpELExpressionParameterValueProvider#potentiallyConvertSpelValue(java.lang.Object, org.springframework.data.mapping.PreferredConstructor.Parameter)
650
658
*/
651
659
@ Override
652
- protected <T > T potentiallyConvertSpelValue (Object object , Parameter <T , ElasticsearchPersistentProperty > parameter ) {
660
+ protected <T > T potentiallyConvertSpelValue (Object object ,
661
+ Parameter <T , ElasticsearchPersistentProperty > parameter ) {
653
662
return readValue (object , parameter .getType ());
654
663
}
655
664
}
@@ -694,7 +703,7 @@ void write(Object source, Document sink) {
694
703
writeTypeHints = entity .writeTypeHints ();
695
704
}
696
705
697
- TypeInformation <?> typeInformation = ClassTypeInformation . from (entityType );
706
+ TypeInformation <?> typeInformation = TypeInformation . of (entityType );
698
707
699
708
if (writeTypeHints && requiresTypeHint (entityType )) {
700
709
typeMapper .writeType (typeInformation , sink );
@@ -707,7 +716,7 @@ void write(Object source, Document sink) {
707
716
* Internal write conversion method which should be used for nested invocations.
708
717
*
709
718
* @param source the object to write
710
- * @param sink the write destination
719
+ * @param sink the destination
711
720
* @param typeInformation type information for the source
712
721
*/
713
722
@ SuppressWarnings ("unchecked" )
@@ -731,12 +740,12 @@ private void writeInternal(@Nullable Object source, Map<String, Object> sink,
731
740
}
732
741
733
742
if (Map .class .isAssignableFrom (entityType )) {
734
- writeMapInternal ((Map <Object , Object >) source , sink , ClassTypeInformation .MAP );
743
+ writeMapInternal ((Map <Object , Object >) source , sink , TypeInformation .MAP );
735
744
return ;
736
745
}
737
746
738
747
if (Collection .class .isAssignableFrom (entityType )) {
739
- writeCollectionInternal ((Collection <?>) source , ClassTypeInformation .LIST , (Collection <?>) sink );
748
+ writeCollectionInternal ((Collection <?>) source , TypeInformation .LIST , (Collection <?>) sink );
740
749
return ;
741
750
}
742
751
@@ -749,7 +758,7 @@ private void writeInternal(@Nullable Object source, Map<String, Object> sink,
749
758
* Internal write conversion method which should be used for nested invocations.
750
759
*
751
760
* @param source the object to write
752
- * @param sink the write destination
761
+ * @param sink the destination
753
762
* @param entity entity for the source
754
763
*/
755
764
private void writeInternal (@ Nullable Object source , Map <String , Object > sink ,
@@ -813,7 +822,7 @@ private Map<String, Object> writeMapInternal(Map<?, ?> source, Map<String, Objec
813
822
} else {
814
823
Map <String , Object > document = Document .create ();
815
824
TypeInformation <?> valueTypeInfo = propertyType .isMap () ? propertyType .getMapValueType ()
816
- : ClassTypeInformation .OBJECT ;
825
+ : TypeInformation .OBJECT ;
817
826
writeInternal (value , document , valueTypeInfo );
818
827
819
828
sink .put (simpleKey , document );
@@ -923,7 +932,7 @@ protected void writeProperty(ElasticsearchPersistentProperty property, Object va
923
932
return ;
924
933
}
925
934
926
- TypeInformation <?> valueType = ClassTypeInformation . from (value .getClass ());
935
+ TypeInformation <?> valueType = TypeInformation . of (value .getClass ());
927
936
TypeInformation <?> type = property .getTypeInformation ();
928
937
929
938
if (valueType .isCollectionLike ()) {
@@ -955,7 +964,7 @@ protected void writeProperty(ElasticsearchPersistentProperty property, Object va
955
964
Map <String , Object > document = existingValue instanceof Map ? (Map <String , Object >) existingValue
956
965
: Document .create ();
957
966
958
- addCustomTypeKeyIfNecessary (value , document , ClassTypeInformation . from (property .getRawType ()));
967
+ addCustomTypeKeyIfNecessary (value , document , TypeInformation . of (property .getRawType ()));
959
968
writeInternal (value , document , entity );
960
969
sink .set (property , document );
961
970
}
0 commit comments