Package org.neo4j.ogm.metadata.reflect
Class EntityAccessManager
java.lang.Object
org.neo4j.ogm.metadata.reflect.EntityAccessManager
Determines how entities should be accessed in both reading and writing scenarios by looking up information from
ClassInfo
in the following order.
- Annotated Field
- Plain Field
- Author:
- Adam George, Luanne Misquitta, Michael J. Simons
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FieldInfo
getIterableField
(ClassInfo classInfo, Class<?> parameterType, String relationshipType, Relationship.Direction relationshipDirection) Returns an FieldWriter for an iterable of a non-primitive scalar type defined by a ClassInfostatic FieldInfo
getRelationalReader
(ClassInfo classInfo, String relationshipType, Relationship.Direction relationshipDirection) Returns a FieldInfo for a scalar type definition on a ClassInfo that is not a primitive graph propertystatic FieldInfo
getRelationalWriter
(ClassInfo classInfo, String relationshipType, Relationship.Direction relationshipDirection, Class<?> objectType) Returns a FieldWriter for a scalar type on a ClassInfo that is not a primitive graph propertystatic FieldInfo
getRelationalWriter
(ClassInfo classInfo, String relationshipType, Relationship.Direction relationshipDirection, Object scalarValue) Returns a FieldWriter for a scalar value represented as a relationship in the graph (i.e.static Object
static Object
merge
(Class<?> collectionType, Object newValues, Collection currentValues, Class elementType) Merges the contents of collection with hydrated ensuring no duplicates and returns the result as an instance of the given parameter type.
-
Constructor Details
-
EntityAccessManager
public EntityAccessManager()
-
-
Method Details
-
merge
-
merge
public static Object merge(Class<?> collectionType, Object newValues, Collection currentValues, Class elementType) Merges the contents of collection with hydrated ensuring no duplicates and returns the result as an instance of the given parameter type.- Parameters:
collectionType
- The type of Iterable or array to returnnewValues
- The objects to merge into a collection of the given parameter type, which may not necessarily be of a type assignable from collectionType alreadycurrentValues
- The Iterable to merge into, which may benull
if a new collection needs creatingelementType
- The type of the element in the array or collection (After conversion has been applied)- Returns:
- The result of the merge, as an instance of the specified parameter type
-
getRelationalWriter
public static FieldInfo getRelationalWriter(ClassInfo classInfo, String relationshipType, Relationship.Direction relationshipDirection, Object scalarValue) Returns a FieldWriter for a scalar value represented as a relationship in the graph (i.e. not a primitive property)- Parameters:
classInfo
- the ClassInfo (or a superclass thereof) declaring the relationshiprelationshipType
- the name of the relationship as it is in the graphrelationshipDirection
- the direction of the relationship as it is in the graphscalarValue
- an Object whose class the relationship is defined for- Returns:
- a valid FieldWriter or null if none is found
-
getRelationalWriter
public static FieldInfo getRelationalWriter(ClassInfo classInfo, String relationshipType, Relationship.Direction relationshipDirection, Class<?> objectType) Returns a FieldWriter for a scalar type on a ClassInfo that is not a primitive graph property- Parameters:
classInfo
- the ClassInfo (or a superclass thereof) declaring the relationshiprelationshipType
- the name of the relationship as it is in the graphrelationshipDirection
- the direction of the relationship as it is in the graphobjectType
- the class the relationship is defined for- Returns:
- a valid FieldWriter or null if none is found
-
getRelationalReader
public static FieldInfo getRelationalReader(ClassInfo classInfo, String relationshipType, Relationship.Direction relationshipDirection) Returns a FieldInfo for a scalar type definition on a ClassInfo that is not a primitive graph property- Parameters:
classInfo
- A ClassInfo declaring the type definitionrelationshipType
- The name of the relationship in the graphrelationshipDirection
- The direction of the relationship in the graph- Returns:
- A FieldInfo or null if none exists
-
getIterableField
public static FieldInfo getIterableField(ClassInfo classInfo, Class<?> parameterType, String relationshipType, Relationship.Direction relationshipDirection) Returns an FieldWriter for an iterable of a non-primitive scalar type defined by a ClassInfo- Parameters:
classInfo
- the ClassInfo (or a superclass thereof) declaring the iterable relationshiprelationshipType
- the name of the relationship as it is in the graphrelationshipDirection
- the direction of the relationship as it is in the graphparameterType
- the type that will be iterated over- Returns:
- a valid FieldWriter or null if none is found
-