@API(status=STABLE,
since="6.0")
public interface Neo4jConversionService
Neo4jConversions registered.
It provides simple delegating functions that allow for an override of the converter being used.| Modifier and Type | Method and Description |
|---|---|
<T> T |
convert(Object source,
Class<T> targetType)
Delegates to the underlying service, without the possibility to run a custom conversion.
|
boolean |
hasCustomWriteTarget(Class<?> sourceType)
Returns whether we have a custom conversion registered to read
sourceType into a native type. |
Object |
readValue(org.neo4j.driver.Value source,
TypeInformation<?> targetType,
Function<org.neo4j.driver.Value,Object> conversionOverride)
Reads a
Value returned by the driver and converts it into a simple type supported
by Neo4j SDN. |
org.neo4j.driver.Value |
writeValue(Object value,
TypeInformation<?> sourceType,
Function<Object,org.neo4j.driver.Value> conversionOverride)
Converts an
Object to a driver's value object. |
@Nullable <T> T convert(Object source, Class<T> targetType)
T - The type to be returnedsource - The source to be convertedtargetType - The target typeboolean hasCustomWriteTarget(Class<?> sourceType)
sourceType into a native type. The returned
type might be a subclass of the given expected type though.sourceType - must not be nullCustomConversions.hasCustomWriteTarget(Class)@Nullable Object readValue(@Nullable org.neo4j.driver.Value source, TypeInformation<?> targetType, @Nullable Function<org.neo4j.driver.Value,Object> conversionOverride)
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.Values.NULL.TypeMismatchDataAccessException - In case the value cannot be converted to the target typeorg.neo4j.driver.Value writeValue(@Nullable Object value, TypeInformation<?> sourceType, @Nullable Function<Object,org.neo4j.driver.Value> conversionOverride)
Object to a driver's value object.value - The value to get written, may be null.sourceType - The type information describing the target type.Copyright © 2019–2021 Neo4j, Neo4j Sweden AB. All rights reserved.