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.- Since:
- 6.0
- Author:
- Michael J. Simons
-
Method Summary
Modifier and TypeMethodDescription<T> @Nullable TDelegates to the underlying service, without the possibility to run a custom conversion.booleanhasCustomWriteTarget(Class<?> sourceType) Returns whether we have a custom conversion registered to readsourceTypeinto a native type.booleanisSimpleType(Class<?> type) Return true if the given class represents a Neo4j simple type.@Nullable ObjectreadValue(@Nullable org.neo4j.driver.Value source, TypeInformation<?> targetType, @Nullable Neo4jPersistentPropertyConverter<?> conversionOverride) Reads aValuereturned by the driver and converts it into asimple typesupported by Neo4j SDN.org.neo4j.driver.ValuewriteValue(@Nullable Object value, TypeInformation<?> sourceType, @Nullable Neo4jPersistentPropertyConverter<?> conversionOverride) Converts anObjectto a driver's value object.
-
Method Details
-
convert
-
hasCustomWriteTarget
Returns whether we have a custom conversion registered to readsourceTypeinto a native type. The returned type might be a subclass of the given expected type though.- Parameters:
sourceType- must not be null- Returns:
- 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 aValuereturned by the driver and converts it into asimple typesupported by Neo4j SDN. If the value cannot be converted, aTypeMismatchDataAccessExceptionwill 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.
- Parameters:
source- the value to be read, may be null.targetType- the type information describing the target type.conversionOverride- an optional conversion override.- Returns:
- a simple type or null, if the value was null or
Values.NULL. - Throws:
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 anObjectto a driver's value object.- Parameters:
value- the value to get written, may be null.sourceType- the type information describing the target type.conversionOverride- a conversion overriding the default- Returns:
- a driver compatible value object.
-
isSimpleType
Return true if the given class represents a Neo4j simple type.- Parameters:
type- a type that should be checked whether it's simple or not- Returns:
- true if
typeis a simple type, according toNeo4jSimpleTypesand the registered converters.
-