Class ValueAdapter
java.lang.Object
org.neo4j.driver.internal.types.InternalMapAccessorWithDefaultValue
org.neo4j.driver.internal.value.ValueAdapter
- All Implemented Interfaces:
org.neo4j.bolt.connection.values.Value, InternalValue, MapAccessor, MapAccessorWithDefaultValue, Value
- Direct Known Subclasses:
BooleanValue, BytesValue, ListValue, MapValue, NullValue, NumberValueAdapter, ObjectValueAdapter, StringValue, UnsupportedDateTimeValue, UUIDValue
public abstract class ValueAdapter
extends InternalMapAccessorWithDefaultValue
implements InternalValue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.neo4j.bolt.connection.values.VectorbooleanReturns the value as a Java boolean, if possible.booleanasBoolean(boolean defaultValue) Returns the value as a Java boolean, if possible.byte[]Returns the value as a Java byte array, if possible.byte[]asByteArray(byte[] defaultValue) Returns the value as a Java byte array, if possible.doubleasDouble()Returns a Java double if no precision is lost in the conversion.doubleasDouble(double defaultValue) Returns a Java double if no precision is lost in the conversion.asEntity()Returns the value as aEntity, if possible.floatasFloat()Returns a Java float if no precision is lost in the conversion.floatasFloat(float defaultValue) Returns a Java float if no precision is lost in the conversion.intasInt()Returns a Java int if no precision is lost in the conversion.intasInt(int defaultValue) Returns a Java int if no precision is lost in the conversion.Returns the value as aIsoDuration, if possible.asIsoDuration(IsoDuration defaultValue) Returns the value as aIsoDuration, if possible.asList()If the underlying type can be viewed as a list, returns a java list of values, where each value has been converted usingValue.asObject().<T> List<T> Returns the value as a list of T obtained by mapping from the list elements, if possible.<T> List<T> Returns the value as a list of T obtained by mapping from the list elements, if possible.If the underlying type can be viewed as a list, returns a java list of values, where each value has been converted usingValue.asObject().Returns the value as aLocalDate, if possible.asLocalDate(LocalDate defaultValue) Returns the value as aLocalDate, if possible.Returns the value as aLocalDateTime, if possible.asLocalDateTime(LocalDateTime defaultValue) Returns the value as aLocalDateTime, if possible.Returns the value as aLocalTime, if possible.asLocalTime(LocalTime defaultValue) Returns the value as aLocalTime, if possible.longasLong()Returns a Java long if no precision is lost in the conversion.longasLong(long defaultValue) Returns a Java long if no precision is lost in the conversion.asMap()Return the underlying map as a map of string keys and values converted usingValue.asObject().Return the underlying map as a map of string keys and values converted using the supplied function.Returns the value as a map from string keys to values of type T obtained from mapping he original map values, if possible.Return as a map of string keys and values converted usingValue.asObject().protected <T> TasNode()Returns the value as aNode, if possible.asNumber()Returns the value as a Java Number, if possible.asObject()This returns a java standard library representation of the underlying value, using a java type that is "sensible" given the underlying type.Returns the value as aOffsetDateTime, if possible.asOffsetDateTime(OffsetDateTime defaultValue) Returns the value as aOffsetDateTime, if possible.Returns the value as aOffsetTime, if possible.asOffsetTime(OffsetTime defaultValue) Returns the value as aOffsetTime, if possible.asPath()Returns the value as aPath, if possible.asPoint()Returns the value as aPoint, if possible.Returns the value as aPoint, if possible.Returns the value as aRelationship, if possible.asString()Returns the value as a Java String, if possible.Returns the value as a Java String, if possible.Returns the value as anUnsupportedType, if possible.asUUID()Returns the value as aUUID, if possible.asValue()asVector()Returns the value as anVector, if possible.Returns the value as aZonedDateTime, if possible.asZonedDateTime(ZonedDateTime defaultValue) Returns the value as aZonedDateTime, if possible.<T> TcomputeOrDefault(Function<Value, T> mapper, T defaultValue) booleancontainsKey(String key) Check if the list of keys contains the given keyabstract booleanget(int index) Retrieve the value at the given indexRetrieve the value of the property with the given keyabstract inthashCode()booleanTest if this value is a value of the given type.booleanisEmpty()If this value represents a list or map, test if the collection is empty.booleanisFalse()Returnstrueif the value is a Boolean value and has the value False.booleanisNull()Returnstrueif the value is a Null, otherwisefalse.booleanisTrue()Returnstrueif the value is a Boolean value and has the value True.keys()Retrieve the keys of the underlying mapintsize()Retrieve the number of entries in this mapabstract StringtoString()final TypeConstructorvalues()Retrieve all values of the underlying collection<T> Iterable<T> Map and retrieve all values of the underlying collectionMethods inherited from class InternalMapAccessorWithDefaultValue
get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getMethods inherited from interface InternalValue
as, as, asBoltIsoDuration, asBoltMap, asBoltPoint, boltValues, getBoltValueMethods inherited from interface MapAccessorWithDefaultValue
get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getMethods inherited from interface org.neo4j.bolt.connection.values.Value
boltValueType
-
Constructor Details
-
ValueAdapter
public ValueAdapter()
-
-
Method Details
-
asValue
-
hasType
-
isTrue
-
isFalse
-
isNull
-
containsKey
Description copied from interface:MapAccessorCheck if the list of keys contains the given key- Specified by:
containsKeyin interfaceMapAccessor- Parameters:
key- the key- Returns:
trueif this map keys contains the given key otherwisefalse
-
asString
-
asBoolean
public boolean asBoolean(boolean defaultValue) Description copied from interface:ValueReturns the value as a Java boolean, if possible. -
asString
-
asLong
-
asInt
-
asDouble
public double asDouble(double defaultValue) Description copied from interface:ValueReturns a Java double if no precision is lost in the conversion. -
asFloat
-
asLong
-
asInt
-
asFloat
-
asDouble
-
asBoolean
-
asList
Description copied from interface:ValueIf the underlying type can be viewed as a list, returns a java list of values, where each value has been converted usingValue.asObject(). -
asList
Description copied from interface:ValueReturns the value as a list of T obtained by mapping from the list elements, if possible.- Specified by:
asListin interfaceValue- Type Parameters:
T- the type of target list elements- Parameters:
mapFunction- a function to map from Value to T. SeeValuesfor some predefined functions, such asValues.ofBoolean(),Values.ofList(Function).- Returns:
- the value as a list of T obtained by mapping from the list elements, if possible
- See Also:
-
asMap
Description copied from interface:MapAccessorReturn the underlying map as a map of string keys and values converted usingValue.asObject().This is equivalent to calling
MapAccessor.asMap(Function)withValues.ofObject().- Specified by:
asMapin interfaceMapAccessor- Returns:
- the value as a Java map
-
asMap
Description copied from interface:MapAccessorReturn the underlying map as a map of string keys and values converted using the supplied function.- Specified by:
asMapin interfaceMapAccessor- Type Parameters:
T- the type of map values- Parameters:
mapFunction- a function to map from Value to T. SeeValuesfor some predefined functions, such asValues.ofBoolean(),Values.ofList(Function).- Returns:
- the value as a map from string keys to values of type T obtained from mapping the original map values, if possible
- See Also:
-
asObject
Description copied from interface:ValueThis returns a java standard library representation of the underlying value, using a java type that is "sensible" given the underlying type. The mapping for common types is as follows:TypeSystem.NULL()-nullTypeSystem.LIST()-ListTypeSystem.MAP()-MapTypeSystem.BOOLEAN()-BooleanTypeSystem.INTEGER()-LongTypeSystem.FLOAT()-DoubleTypeSystem.STRING()-StringTypeSystem.BYTES()- byte[]TypeSystem.DATE()-LocalDateTypeSystem.TIME()-OffsetTimeTypeSystem.LOCAL_TIME()-LocalTimeTypeSystem.DATE_TIME()-ZonedDateTimeTypeSystem.LOCAL_DATE_TIME()-LocalDateTimeTypeSystem.DURATION()-IsoDurationTypeSystem.POINT()-PointTypeSystem.NODE()-NodeTypeSystem.RELATIONSHIP()-RelationshipTypeSystem.PATH()-Path
Note that the types in
TypeSystemrefers to the Neo4j type system whereTypeSystem.INTEGER()andTypeSystem.FLOAT()are both 64-bit precision. This is why these types return javaLongandDouble, respectively. -
computeOrDefault
Description copied from interface:ValueApply the mapping function on the value if the value is not aNullValue, or the default value if the value is aNullValue.- Specified by:
computeOrDefaultin interfaceValue- Type Parameters:
T- The return type- Parameters:
mapper- The mapping function defines how to map aValueto T.defaultValue- the value to return if the value is aNullValue- Returns:
- The value after applying the given mapping function or the default value if the value is
NullValue.
-
asMap
Description copied from interface:ValueReturn as a map of string keys and values converted usingValue.asObject().This is equivalent to calling
Value.asMap(Function, Map)withValues.ofObject(). -
asMap
Description copied from interface:ValueReturns the value as a map from string keys to values of type T obtained from mapping he original map values, if possible.- Specified by:
asMapin interfaceValue- Type Parameters:
T- the type of map values- Parameters:
mapFunction- a function to map from Value to T. SeeValuesfor some predefined functions, such asValues.ofBoolean(),Values.ofList(Function).defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a map from string keys to values of type T obtained from mapping he original map values, if possible
- See Also:
-
asByteArray
public byte[] asByteArray(byte[] defaultValue) Description copied from interface:ValueReturns the value as a Java byte array, if possible.- Specified by:
asByteArrayin interfaceValue- Parameters:
defaultValue- default to this value if the original value is aNullValue- Returns:
- the value as a Java byte array, if possible
-
asList
Description copied from interface:ValueIf the underlying type can be viewed as a list, returns a java list of values, where each value has been converted usingValue.asObject(). -
asList
Description copied from interface:ValueReturns the value as a list of T obtained by mapping from the list elements, if possible.- Specified by:
asListin interfaceValue- Type Parameters:
T- the type of target list elements- Parameters:
mapFunction- a function to map from Value to T. SeeValuesfor some predefined functions, such asValues.ofBoolean(),Values.ofList(Function).defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a list of T obtained by mapping from the list elements, if possible
- See Also:
-
asLocalDate
-
asOffsetTime
Description copied from interface:ValueReturns the value as aOffsetTime, if possible.- Specified by:
asOffsetTimein interfaceValue- Parameters:
defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a
OffsetTime, if possible
-
asLocalTime
-
asLocalDateTime
Description copied from interface:ValueReturns the value as aLocalDateTime, if possible.- Specified by:
asLocalDateTimein interfaceValue- Parameters:
defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a
LocalDateTime, if possible
-
asOffsetDateTime
Description copied from interface:ValueReturns the value as aOffsetDateTime, if possible.- Specified by:
asOffsetDateTimein interfaceValue- Parameters:
defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a
OffsetDateTime, if possible
-
asZonedDateTime
Description copied from interface:ValueReturns the value as aZonedDateTime, if possible.- Specified by:
asZonedDateTimein interfaceValue- Parameters:
defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a
ZonedDateTime, if possible
-
asIsoDuration
Description copied from interface:ValueReturns the value as aIsoDuration, if possible.- Specified by:
asIsoDurationin interfaceValue- Parameters:
defaultValue- default to this value if the value is aNullValue- Returns:
- the value as a
IsoDuration, if possible
-
asPoint
-
asByteArray
public byte[] asByteArray()Description copied from interface:ValueReturns the value as a Java byte array, if possible.- Specified by:
asByteArrayin interfaceorg.neo4j.bolt.connection.values.Value- Specified by:
asByteArrayin interfaceValue- Returns:
- the value as a Java byte array, if possible
-
asNumber
-
asEntity
-
asNode
-
asPath
-
asRelationship
Description copied from interface:ValueReturns the value as aRelationship, if possible.- Specified by:
asRelationshipin interfaceValue- Returns:
- the value as a
Relationship, if possible
-
asLocalDate
-
asOffsetTime
Description copied from interface:ValueReturns the value as aOffsetTime, if possible.- Specified by:
asOffsetTimein interfaceorg.neo4j.bolt.connection.values.Value- Specified by:
asOffsetTimein interfaceValue- Returns:
- the value as a
OffsetTime, if possible
-
asLocalTime
-
asLocalDateTime
Description copied from interface:ValueReturns the value as aLocalDateTime, if possible.- Specified by:
asLocalDateTimein interfaceorg.neo4j.bolt.connection.values.Value- Specified by:
asLocalDateTimein interfaceValue- Returns:
- the value as a
LocalDateTime, if possible
-
asOffsetDateTime
Description copied from interface:ValueReturns the value as aOffsetDateTime, if possible.- Specified by:
asOffsetDateTimein interfaceValue- Returns:
- the value as a
OffsetDateTime, if possible
-
asZonedDateTime
Description copied from interface:ValueReturns the value as aZonedDateTime, if possible.- Specified by:
asZonedDateTimein interfaceorg.neo4j.bolt.connection.values.Value- Specified by:
asZonedDateTimein interfaceValue- Returns:
- the value as a
ZonedDateTime, if possible
-
asIsoDuration
Description copied from interface:ValueReturns the value as aIsoDuration, if possible.- Specified by:
asIsoDurationin interfaceValue- Returns:
- the value as a
IsoDuration, if possible
-
asPoint
-
asVector
-
asUnsupportedType
Description copied from interface:ValueReturns the value as anUnsupportedType, if possible.- Specified by:
asUnsupportedTypein interfaceValue- Returns:
- the value as a
UnsupportedType, if possible
-
asUUID
-
get
-
get
Description copied from interface:MapAccessorRetrieve the value of the property with the given key- Specified by:
getin interfaceMapAccessor- Specified by:
getin classInternalMapAccessorWithDefaultValue- Parameters:
key- the key of the property- Returns:
- the property's value or a
NullValueif no such key exists
-
size
public int size()Description copied from interface:MapAccessorRetrieve the number of entries in this map- Specified by:
sizein interfaceMapAccessor- Specified by:
sizein interfaceValue- Returns:
- the number of entries in this map
-
keys
Description copied from interface:MapAccessorRetrieve the keys of the underlying map- Specified by:
keysin interfaceMapAccessor- Specified by:
keysin interfaceValue- Returns:
- all map keys in unspecified order
-
isEmpty
-
values
Description copied from interface:MapAccessorRetrieve all values of the underlying collection- Specified by:
valuesin interfaceMapAccessor- Returns:
- all values in unspecified order
-
values
Description copied from interface:MapAccessorMap and retrieve all values of the underlying collection- Specified by:
valuesin interfaceMapAccessor- Type Parameters:
T- the target type of mapping- Parameters:
mapFunction- a function to map from Value to T. SeeValuesfor some predefined functions, such asValues.ofBoolean(),Values.ofList(Function).- Returns:
- the result of mapping all values in unspecified order
-
asBoltVector
public org.neo4j.bolt.connection.values.Vector asBoltVector()- Specified by:
asBoltVectorin interfaceorg.neo4j.bolt.connection.values.Value
-
typeConstructor
- Specified by:
typeConstructorin interfaceInternalValue
-
asMapped
-
equals
-
hashCode
-
toString
-