@ -15,6 +15,8 @@
@@ -15,6 +15,8 @@
* /
package org.springframework.data.mongodb.core.convert ;
import lombok.Value ;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.List ;
@ -32,8 +34,8 @@ import com.mongodb.DBObject;
@@ -32,8 +34,8 @@ import com.mongodb.DBObject;
* when resolving more nested objects . This allows to avoid re - resolving object instances that are logically equivalent
* to already resolved ones .
* < p >
* An immutable ordered set of target objects for { @link DBObject } to { @link Object } conversions . Object paths can be
* constructed by the { @link # toObjectPath ( Object ) } method and extended via { @link # push ( Object ) } .
* An immutable ordered set of target objects for { @link DBObject } to { @link Object } conversions . Object paths
* can be extended via { @link # push ( Object , MongoPersistentEntity , Object ) } .
*
* @author Thomas Darimont
* @author Oliver Gierke
@ -139,7 +141,7 @@ class ObjectPath {
@@ -139,7 +141,7 @@ class ObjectPath {
if ( collection . equals ( item . getCollection ( ) ) & & id . equals ( item . getIdValue ( ) )
& & ClassUtils . isAssignable ( type , object . getClass ( ) ) ) {
return ( T ) object ;
return type . cast ( object ) ;
}
}
@ -180,37 +182,13 @@ class ObjectPath {
@@ -180,37 +182,13 @@ class ObjectPath {
*
* @author Thomas Darimont
* @author Oliver Gierke
* @author Mark Paluch
* /
@Value
private static class ObjectPathItem {
private final Object object ;
private final Object idValue ;
private final String collection ;
/ * *
* Creates a new { @link ObjectPathItem } .
*
* @param object
* @param idValue
* @param collection
* /
ObjectPathItem ( Object object , Object idValue , String collection ) {
this . object = object ;
this . idValue = idValue ;
this . collection = collection ;
}
Object getObject ( ) {
return object ;
}
Object getIdValue ( ) {
return idValue ;
}
String getCollection ( ) {
return collection ;
}
Object object ;
Object idValue ;
String collection ;
}
}