@ -3029,12 +3029,13 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
@Nullable
@Nullable
public T doWith ( @Nullable Document object ) {
public T doWith ( @Nullable Document object ) {
T source = null ;
if ( null ! = object ) {
if ( null ! = object ) {
maybeEmitEvent ( new AfterLoadEvent < > ( object , type , collectionName ) ) ;
maybeEmitEvent ( new AfterLoadEvent < > ( object , type , collectionName ) ) ;
source = reader . read ( type , object ) ;
}
}
T source = reader . read ( type , object ) ;
if ( null ! = source ) {
if ( null ! = source ) {
maybeEmitEvent ( new AfterConvertEvent < > ( object , source , collectionName ) ) ;
maybeEmitEvent ( new AfterConvertEvent < > ( object , source , collectionName ) ) ;
}
}
@ -3074,9 +3075,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
Class < ? > typeToRead = targetType . isInterface ( ) | | targetType . isAssignableFrom ( entityType ) ? entityType
Class < ? > typeToRead = targetType . isInterface ( ) | | targetType . isAssignableFrom ( entityType ) ? entityType
: targetType ;
: targetType ;
if ( null ! = object ) {
maybeEmitEvent ( new AfterLoadEvent < > ( object , targetType , collectionName ) ) ;
maybeEmitEvent ( new AfterLoadEvent < > ( object , targetType , collectionName ) ) ;
}
Object source = reader . read ( typeToRead , object ) ;
Object source = reader . read ( typeToRead , object ) ;
Object result = targetType . isInterface ( ) ? projectionFactory . createProjection ( targetType , source ) : source ;
Object result = targetType . isInterface ( ) ? projectionFactory . createProjection ( targetType , source ) : source ;