5050import org .springframework .data .annotation .Reference ;
5151import org .springframework .data .convert .CustomConversions ;
5252import org .springframework .data .convert .TypeMapper ;
53- import org .springframework .data .mapping .AccessOptions ;
54- import org .springframework .data .mapping .Association ;
55- import org .springframework .data .mapping .MappingException ;
56- import org .springframework .data .mapping .Parameter ;
57- import org .springframework .data .mapping .PersistentEntity ;
58- import org .springframework .data .mapping .PersistentProperty ;
59- import org .springframework .data .mapping .PersistentPropertyAccessor ;
60- import org .springframework .data .mapping .PersistentPropertyPath ;
61- import org .springframework .data .mapping .PersistentPropertyPathAccessor ;
62- import org .springframework .data .mapping .PreferredConstructor ;
53+ import org .springframework .data .mapping .*;
6354import org .springframework .data .mapping .callback .EntityCallbacks ;
6455import org .springframework .data .mapping .context .MappingContext ;
6556import org .springframework .data .mapping .model .ConvertingPropertyAccessor ;
@@ -123,7 +114,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
123114 private static final String INCOMPATIBLE_TYPES = "Cannot convert %1$s of type %2$s into an instance of %3$s; Implement a custom Converter<%2$s, %3$s> and register it with the CustomConversions; Parent object was: %4$s" ;
124115 private static final String INVALID_TYPE_TO_READ = "Expected to read Document %s into type %s but didn't find a PersistentEntity for the latter" ;
125116
126- public static final ClassTypeInformation <Bson > BSON = ClassTypeInformation . from (Bson .class );
117+ public static final TypeInformation <Bson > BSON = TypeInformation . of (Bson .class );
127118
128119 protected static final Log LOGGER = LogFactory .getLog (MappingMongoConverter .class );
129120
@@ -353,9 +344,9 @@ String getFieldName(MongoPersistentProperty prop) {
353344 }
354345 };
355346
356- PreferredConstructor <?, MongoPersistentProperty > persistenceConstructor = mappedEntity .getPersistenceConstructor ();
357- ParameterValueProvider <MongoPersistentProperty > provider = persistenceConstructor != null
358- && persistenceConstructor .hasParameters ()
347+ InstanceCreatorMetadata < MongoPersistentProperty > instanceCreatorMetadata = mappedEntity .getInstanceCreatorMetadata ();
348+ ParameterValueProvider <MongoPersistentProperty > provider = instanceCreatorMetadata != null
349+ && instanceCreatorMetadata .hasParameters ()
359350 ? getParameterProvider (context , mappedEntity , documentAccessor , evaluator )
360351 : NoOpParameterValueProvider .INSTANCE ;
361352
@@ -405,7 +396,7 @@ public Map<String, Object> getBean() {
405396 }
406397
407398 public <S extends Object > S read (Class <S > clazz , Bson bson ) {
408- return read (ClassTypeInformation . from (clazz ), bson );
399+ return read (TypeInformation . of (clazz ), bson );
409400 }
410401
411402 protected <S extends Object > S read (TypeInformation <S > type , Bson bson ) {
@@ -498,10 +489,10 @@ private <S> S read(ConversionContext context, MongoPersistentEntity<S> entity, D
498489 SpELExpressionEvaluator evaluator = new DefaultSpELExpressionEvaluator (bson , spELContext );
499490 DocumentAccessor documentAccessor = new DocumentAccessor (bson );
500491
501- PreferredConstructor < S , MongoPersistentProperty > persistenceConstructor = entity .getPersistenceConstructor ();
492+ InstanceCreatorMetadata < MongoPersistentProperty > instanceCreatorMetadata = entity .getInstanceCreatorMetadata ();
502493
503- ParameterValueProvider <MongoPersistentProperty > provider = persistenceConstructor != null
504- && persistenceConstructor .hasParameters () ? getParameterProvider (context , entity , documentAccessor , evaluator )
494+ ParameterValueProvider <MongoPersistentProperty > provider = instanceCreatorMetadata != null
495+ && instanceCreatorMetadata .hasParameters () ? getParameterProvider (context , entity , documentAccessor , evaluator )
505496 : NoOpParameterValueProvider .INSTANCE ;
506497
507498 EntityInstantiator instantiator = instantiators .getInstantiatorFor (entity );
@@ -552,7 +543,7 @@ private Object readAndPopulateIdentifier(ConversionContext context, PersistentPr
552543
553544 MongoPersistentProperty idProperty = entity .getRequiredIdProperty ();
554545
555- if (idProperty .isImmutable () && entity .isConstructorArgument (idProperty )) {
546+ if (idProperty .isImmutable () && entity .isCreatorArgument (idProperty )) {
556547 return rawId ;
557548 }
558549
@@ -587,7 +578,7 @@ private void readProperties(ConversionContext context, MongoPersistentEntity<?>
587578 ConversionContext propertyContext = context .forProperty (prop );
588579 MongoDbPropertyValueProvider valueProviderToUse = valueProvider .withContext (propertyContext );
589580
590- if (prop .isAssociation () && !entity .isConstructorArgument (prop )) {
581+ if (prop .isAssociation () && !entity .isCreatorArgument (prop )) {
591582
592583 if (callback == null ) {
593584 callback = getDbRefResolverCallback (propertyContext , documentAccessor , evaluator );
@@ -761,7 +752,7 @@ public void write(Object obj, Bson bson) {
761752 }
762753
763754 Class <?> entityType = ClassUtils .getUserClass (obj .getClass ());
764- TypeInformation <? extends Object > type = ClassTypeInformation . from (entityType );
755+ TypeInformation <? extends Object > type = TypeInformation . of (entityType );
765756
766757 Object target = obj instanceof LazyLoadingProxy ? ((LazyLoadingProxy ) obj ).getTarget () : obj ;
767758
@@ -805,12 +796,12 @@ protected void writeInternal(@Nullable Object obj, Bson bson, @Nullable TypeInfo
805796 }
806797
807798 if (Map .class .isAssignableFrom (entityType )) {
808- writeMapInternal ((Map <Object , Object >) obj , bson , ClassTypeInformation .MAP );
799+ writeMapInternal ((Map <Object , Object >) obj , bson , TypeInformation .MAP );
809800 return ;
810801 }
811802
812803 if (Collection .class .isAssignableFrom (entityType )) {
813- writeCollectionInternal ((Collection <?>) obj , ClassTypeInformation .LIST , (Collection <?>) bson );
804+ writeCollectionInternal ((Collection <?>) obj , TypeInformation .LIST , (Collection <?>) bson );
814805 return ;
815806 }
816807
@@ -896,7 +887,7 @@ protected void writePropertyInternal(@Nullable Object obj, DocumentAccessor acce
896887 return ;
897888 }
898889
899- TypeInformation <?> valueType = ClassTypeInformation . from (obj .getClass ());
890+ TypeInformation <?> valueType = TypeInformation . of (obj .getClass ());
900891 TypeInformation <?> type = prop .getTypeInformation ();
901892
902893 if (conversions .hasValueConverter (prop )) {
@@ -977,7 +968,7 @@ protected void writePropertyInternal(@Nullable Object obj, DocumentAccessor acce
977968 Document document = existingValue instanceof Document ? (Document ) existingValue : new Document ();
978969
979970 writeInternal (obj , document , entity );
980- addCustomTypeKeyIfNecessary (ClassTypeInformation . from (prop .getRawType ()), obj , document );
971+ addCustomTypeKeyIfNecessary (TypeInformation . of (prop .getRawType ()), obj , document );
981972 accessor .put (prop , document );
982973 }
983974
@@ -998,7 +989,7 @@ protected List<Object> createCollection(Collection<?> collection, MongoPersisten
998989 .getPointer ();
999990 }).collect (Collectors .toList ());
1000991
1001- return writeCollectionInternal (targetCollection , ClassTypeInformation . from (DocumentPointer .class ),
992+ return writeCollectionInternal (targetCollection , TypeInformation . of (DocumentPointer .class ),
1002993 new ArrayList <>());
1003994 }
1004995
@@ -1127,7 +1118,7 @@ protected Bson writeMapInternal(Map<Object, Object> obj, Bson bson, TypeInformat
11271118 } else {
11281119 Document document = new Document ();
11291120 TypeInformation <?> valueTypeInfo = propertyType .isMap () ? propertyType .getMapValueType ()
1130- : ClassTypeInformation .OBJECT ;
1121+ : TypeInformation .OBJECT ;
11311122 writeInternal (val , document , valueTypeInfo );
11321123 BsonUtils .addToMap (bson , simpleKey , document );
11331124 }
@@ -1379,7 +1370,7 @@ protected Object readCollectionOrArray(ConversionContext context, Collection<?>
13791370
13801371 TypeInformation <?> componentType = targetType .getComponentType () != null //
13811372 ? targetType .getComponentType () //
1382- : ClassTypeInformation .OBJECT ;
1373+ : TypeInformation .OBJECT ;
13831374 Class <?> rawComponentType = componentType .getType ();
13841375
13851376 Collection <Object > items = targetType .getType ().isArray () //
@@ -1421,7 +1412,7 @@ protected Map<Object, Object> readMap(ConversionContext context, Bson bson, Type
14211412 Class <?> mapType = getTypeMapper ().readType (bson , targetType ).getType ();
14221413
14231414 TypeInformation <?> keyType = targetType .getComponentType ();
1424- TypeInformation <?> valueType = targetType .getMapValueType () == null ? ClassTypeInformation .OBJECT
1415+ TypeInformation <?> valueType = targetType .getMapValueType () == null ? TypeInformation .OBJECT
14251416 : targetType .getRequiredMapValueType ();
14261417
14271418 Class <?> rawKeyType = keyType != null ? keyType .getType () : Object .class ;
@@ -1827,7 +1818,7 @@ static Predicate<MongoPersistentProperty> isIdentifier(PersistentEntity<?, ?> en
18271818 }
18281819
18291820 static Predicate <MongoPersistentProperty > isConstructorArgument (PersistentEntity <?, ?> entity ) {
1830- return entity ::isConstructorArgument ;
1821+ return entity ::isCreatorArgument ;
18311822 }
18321823
18331824 /**
@@ -2046,7 +2037,7 @@ public boolean isCollectionLike() {
20462037
20472038 @ Override
20482039 public org .springframework .data .util .TypeInformation <?> getComponentType () {
2049- return ClassTypeInformation . from (persistentProperty .getFieldType ());
2040+ return TypeInformation . of (persistentProperty .getFieldType ());
20502041 }
20512042
20522043 @ Override
@@ -2056,7 +2047,7 @@ public boolean isMap() {
20562047
20572048 @ Override
20582049 public org .springframework .data .util .TypeInformation <?> getMapValueType () {
2059- return ClassTypeInformation . from (persistentProperty .getFieldType ());
2050+ return TypeInformation . of (persistentProperty .getFieldType ());
20602051 }
20612052
20622053 @ Override
0 commit comments