Interface Neo4jConversionService

@API(status=STABLE, since="6.0") public interface Neo4jConversionService
This service orchestrates a standard Spring conversion service with Neo4jConversions registered. It provides simple delegating functions that allow for an override of the converter being used.
Michael J. Simons
  • Method Details

    • convert

      @Nullable <T> T convert(Object source, Class<T> targetType)
      Delegates to the underlying service, without the possibility to run a custom conversion.
      Type Parameters:
      T - The type to be returned
      source - The source to be converted
      targetType - The target type
      The converted value
    • hasCustomWriteTarget

      boolean hasCustomWriteTarget(Class<?> sourceType)
      Returns whether we have a custom conversion registered to read sourceType into a native type. The returned type might be a subclass of the given expected type though.
      sourceType - must not be null
      True if a custom write target exists.
      See Also:
    • readValue

      @Nullable Object readValue(@Nullable org.neo4j.driver.Value source, TypeInformation<?> targetType, @Nullable Neo4jPersistentPropertyConverter<?> conversionOverride)
      Reads a Value returned by the driver and converts it into a simple type supported by Neo4j SDN. If the value cannot be converted, a TypeMismatchDataAccessException will be thrown, it's cause indicating the failed conversion.

      The returned object is generic as this method will take create target collections in case the incoming value describes a collection.

      source - The value to be read, may be null.
      targetType - The type information describing the target type.
      conversionOverride - An optional conversion override.
      A simple type or null, if the value was null or Values.NULL.
      TypeMismatchDataAccessException - In case the value cannot be converted to the target type
    • writeValue

      org.neo4j.driver.Value writeValue(@Nullable Object value, TypeInformation<?> sourceType, @Nullable Neo4jPersistentPropertyConverter<?> conversionOverride)
      Converts an Object to a driver's value object.
      value - The value to get written, may be null.
      sourceType - The type information describing the target type.
      A driver compatible value object.
    • isSimpleType

      boolean isSimpleType(Class<?> type)
      type - A type that should be checked whether it's simple or not.
      True if type is a simple type, according to Neo4jSimpleTypes and the registered converters.