Class MappingSupport

java.lang.Object
org.springframework.data.neo4j.core.mapping.MappingSupport

@API(status=INTERNAL, since="6.0") public final class MappingSupport extends Object
Since:
6.0
Author:
Michael J. Simons, Philipp Tölle, Gerrit Meier
  • 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 a Value is a list value and contains only other values with a given type.
      Parameters:
      collectionType - The required collection type system
      requiredType - 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 context
      hasRelationshipProperties - - does this relationship has properties
      isDynamicAssociation - - is the defined relationship a dynamic association
      valueToStore - - either a plain object or MappingSupport.RelationshipPropertiesWithEntityHolder
      propertyAccessor - - PropertyAccessor for the value
      Returns:
      extracted related object or relationship properties