Class MappingSupport
java.lang.Object
org.springframework.data.neo4j.core.mapping.MappingSupport
- Since:
- 6.0
- Author:
- Michael J. Simons, Philipp Tölle, Gerrit Meier
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Class that defines a tuple of relationship with properties and the connected target entity. -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getRelationshipOrRelationshipPropertiesObject
(Neo4jMappingContext neo4jMappingContext, boolean hasRelationshipProperties, boolean isDynamicAssociation, Object valueToStore, PersistentPropertyAccessor<?> propertyAccessor) Extract the relationship properties or just the related object if there are no relationship properties attached.static Predicate<org.neo4j.driver.Value>
isListContainingOnly
(org.neo4j.driver.types.Type collectionType, org.neo4j.driver.types.Type requiredType) A helper that produces a predicate to check whether aValue
is a list value and contains only other values with a given type.static Collection<?>
unifyRelationshipValue
(Neo4jPersistentProperty property, Object rawValue) The value for a relationship can be a scalar object (1:1), a collection (1:n), a map (1:n, but with dynamic relationship types) or a map (1:n) with properties for each relationship.
-
Method Details
-
unifyRelationshipValue
public static Collection<?> unifyRelationshipValue(Neo4jPersistentProperty property, @Nullable Object rawValue) The value for a relationship can be a scalar object (1:1), a collection (1:n), a map (1:n, but with dynamic relationship types) or a map (1:n) with properties for each relationship. This method unifies the type into something iterable, depending on the given inverse type.- Parameters:
rawValue
- The raw value to unify- Returns:
- A unified collection (Either a collection of Map.Entry for dynamic and relationships with properties or a list of related values)
-
isListContainingOnly
public static Predicate<org.neo4j.driver.Value> isListContainingOnly(org.neo4j.driver.types.Type collectionType, org.neo4j.driver.types.Type requiredType) A helper that produces a predicate to check whether aValue
is a list value and contains only other values with a given type.- Parameters:
collectionType
- The required collection type systemrequiredType
- The required type- Returns:
- A predicate
-
getRelationshipOrRelationshipPropertiesObject
public static Object getRelationshipOrRelationshipPropertiesObject(Neo4jMappingContext neo4jMappingContext, boolean hasRelationshipProperties, boolean isDynamicAssociation, Object valueToStore, PersistentPropertyAccessor<?> propertyAccessor) Extract the relationship properties or just the related object if there are no relationship properties attached.- Parameters:
neo4jMappingContext
- - current mapping contexthasRelationshipProperties
- - does this relationship has propertiesisDynamicAssociation
- - is the defined relationship a dynamic associationvalueToStore
- - either a plain object orMappingSupport.RelationshipPropertiesWithEntityHolder
propertyAccessor
- - PropertyAccessor for the value- Returns:
- extracted related object or relationship properties
-