java.lang.Object
org.neo4j.driver.internal.types.InternalMapAccessorWithDefaultValue
org.neo4j.driver.internal.value.ValueAdapter
- All Implemented Interfaces:
org.neo4j.driver.internal.AsValue
,InternalValue
,MapAccessor
,MapAccessorWithDefaultValue
,Value
- Direct Known Subclasses:
BooleanValue
,BytesValue
,ListValue
,MapValue
,NullValue
,NumberValueAdapter
,ObjectValueAdapter
,StringValue
,UnsupportedDateTimeValue
public abstract class ValueAdapter
extends InternalMapAccessorWithDefaultValue
implements InternalValue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the value as a Java boolean, if possible.boolean
asBoolean
(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.double
asDouble()
Returns a Java double if no precision is lost in the conversion.double
asDouble
(double defaultValue) Returns a Java double if no precision is lost in the conversion.asEntity()
Returns the value as aEntity
, if possible.float
asFloat()
Returns a Java float if no precision is lost in the conversion.float
asFloat
(float defaultValue) Returns a Java float if no precision is lost in the conversion.int
asInt()
Returns a Java int if no precision is lost in the conversion.int
asInt
(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.long
asLong()
Returns a Java long if no precision is lost in the conversion.long
asLong
(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> T
asNode()
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.asValue()
Retrieve a value representation of thisReturns the value as aZonedDateTime
, if possible.asZonedDateTime
(ZonedDateTime defaultValue) Returns the value as aZonedDateTime
, if possible.<T> T
computeOrDefault
(Function<Value, T> mapper, T defaultValue) boolean
containsKey
(String key) Check if the list of keys contains the given keyabstract boolean
get
(int index) Retrieve the value at the given indexRetrieve the value of the property with the given keyabstract int
hashCode()
boolean
Test if this value is a value of the given type.boolean
isEmpty()
If this value represents a list or map, test if the collection is empty.boolean
isFalse()
Returnstrue
if the value is a Boolean value and has the value False.boolean
isNull()
Returnstrue
if the value is a Null, otherwisefalse
.boolean
isTrue()
Returnstrue
if the value is a Boolean value and has the value True.keys()
If the underlying value supportskey-based indexing
, return an iterable of the keys in the map, this applies tomap
,node
andTypeSystem.RELATIONSHIP()
relationship} values.int
size()
If the underlying value is a collection type, return the number of values in the collection.abstract String
toString()
final TypeConstructor
values()
Retrieve all values of the underlying collection<T> Iterable
<T> Map and retrieve all values of the underlying collectionMethods inherited from class org.neo4j.driver.internal.types.InternalMapAccessorWithDefaultValue
get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.neo4j.driver.internal.value.InternalValue
as, as, asBoltValue
-
Constructor Details
-
ValueAdapter
public ValueAdapter()
-
-
Method Details
-
asValue
Description copied from interface:org.neo4j.driver.internal.AsValue
Retrieve a value representation of this- Specified by:
asValue
in interfaceorg.neo4j.driver.internal.AsValue
- Returns:
Value
that represents this- See Also:
-
hasType
Description copied from interface:Value
Test if this value is a value of the given type. -
isTrue
public boolean isTrue()Description copied from interface:Value
Returnstrue
if the value is a Boolean value and has the value True. -
isFalse
public boolean isFalse()Description copied from interface:Value
Returnstrue
if the value is a Boolean value and has the value False. -
isNull
public boolean isNull()Description copied from interface:Value
Returnstrue
if the value is a Null, otherwisefalse
. -
containsKey
Description copied from interface:MapAccessor
Check if the list of keys contains the given key- Specified by:
containsKey
in interfaceMapAccessor
- Parameters:
key
- the key- Returns:
true
if this map keys contains the given key otherwisefalse
-
asString
Description copied from interface:Value
Returns the value as a Java String, if possible. -
asBoolean
public boolean asBoolean(boolean defaultValue) Description copied from interface:Value
Returns the value as a Java boolean, if possible. -
asString
Description copied from interface:Value
Returns the value as a Java String, if possible. -
asLong
public long asLong(long defaultValue) Description copied from interface:Value
Returns a Java long if no precision is lost in the conversion. -
asInt
public int asInt(int defaultValue) Description copied from interface:Value
Returns a Java int if no precision is lost in the conversion. -
asDouble
public double asDouble(double defaultValue) Description copied from interface:Value
Returns a Java double if no precision is lost in the conversion. -
asFloat
public float asFloat(float defaultValue) Description copied from interface:Value
Returns a Java float if no precision is lost in the conversion. -
asLong
public long asLong()Description copied from interface:Value
Returns a Java long if no precision is lost in the conversion. -
asInt
public int asInt()Description copied from interface:Value
Returns a Java int if no precision is lost in the conversion. -
asFloat
public float asFloat()Description copied from interface:Value
Returns a Java float if no precision is lost in the conversion. -
asDouble
public double asDouble()Description copied from interface:Value
Returns a Java double if no precision is lost in the conversion. -
asBoolean
public boolean asBoolean()Description copied from interface:Value
Returns the value as a Java boolean, if possible. -
asList
Description copied from interface:Value
If 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:Value
Returns the value as a list of T obtained by mapping from the list elements, if possible.- Specified by:
asList
in interfaceValue
- Type Parameters:
T
- the type of target list elements- Parameters:
mapFunction
- a function to map from Value to T. SeeValues
for 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:MapAccessor
Return 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:
asMap
in interfaceMapAccessor
- Returns:
- the value as a Java map
-
asMap
Description copied from interface:MapAccessor
Return the underlying map as a map of string keys and values converted using the supplied function.- Specified by:
asMap
in interfaceMapAccessor
- Type Parameters:
T
- the type of map values- Parameters:
mapFunction
- a function to map from Value to T. SeeValues
for 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:Value
This 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()
-null
TypeSystem.LIST()
-List
TypeSystem.MAP()
-Map
TypeSystem.BOOLEAN()
-Boolean
TypeSystem.INTEGER()
-Long
TypeSystem.FLOAT()
-Double
TypeSystem.STRING()
-String
TypeSystem.BYTES()
- byte[]TypeSystem.DATE()
-LocalDate
TypeSystem.TIME()
-OffsetTime
TypeSystem.LOCAL_TIME()
-LocalTime
TypeSystem.DATE_TIME()
-ZonedDateTime
TypeSystem.LOCAL_DATE_TIME()
-LocalDateTime
TypeSystem.DURATION()
-IsoDuration
TypeSystem.POINT()
-Point
TypeSystem.NODE()
-Node
TypeSystem.RELATIONSHIP()
-Relationship
TypeSystem.PATH()
-Path
Note that the types in
TypeSystem
refers to the Neo4j type system whereTypeSystem.INTEGER()
andTypeSystem.FLOAT()
are both 64-bit precision. This is why these types return javaLong
andDouble
, respectively. -
computeOrDefault
Description copied from interface:Value
Apply the mapping function on the value if the value is not aNullValue
, or the default value if the value is aNullValue
.- Specified by:
computeOrDefault
in interfaceValue
- Type Parameters:
T
- The return type- Parameters:
mapper
- The mapping function defines how to map aValue
to 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:Value
Return 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:Value
Returns the value as a map from string keys to values of type T obtained from mapping he original map values, if possible.- Specified by:
asMap
in interfaceValue
- Type Parameters:
T
- the type of map values- Parameters:
mapFunction
- a function to map from Value to T. SeeValues
for 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:Value
Returns the value as a Java byte array, if possible.- Specified by:
asByteArray
in 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:Value
If 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:Value
Returns the value as a list of T obtained by mapping from the list elements, if possible.- Specified by:
asList
in interfaceValue
- Type Parameters:
T
- the type of target list elements- Parameters:
mapFunction
- a function to map from Value to T. SeeValues
for 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
Description copied from interface:Value
Returns the value as aLocalDate
, if possible.- Specified by:
asLocalDate
in interfaceValue
- Parameters:
defaultValue
- default to this value if the value is aNullValue
- Returns:
- the value as a
LocalDate
, if possible
-
asOffsetTime
Description copied from interface:Value
Returns the value as aOffsetTime
, if possible.- Specified by:
asOffsetTime
in interfaceValue
- Parameters:
defaultValue
- default to this value if the value is aNullValue
- Returns:
- the value as a
OffsetTime
, if possible
-
asLocalTime
Description copied from interface:Value
Returns the value as aLocalTime
, if possible.- Specified by:
asLocalTime
in interfaceValue
- Parameters:
defaultValue
- default to this value if the value is aNullValue
- Returns:
- the value as a
LocalTime
, if possible
-
asLocalDateTime
Description copied from interface:Value
Returns the value as aLocalDateTime
, if possible.- Specified by:
asLocalDateTime
in 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:Value
Returns the value as aOffsetDateTime
, if possible.- Specified by:
asOffsetDateTime
in 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:Value
Returns the value as aZonedDateTime
, if possible.- Specified by:
asZonedDateTime
in 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:Value
Returns the value as aIsoDuration
, if possible.- Specified by:
asIsoDuration
in interfaceValue
- Parameters:
defaultValue
- default to this value if the value is aNullValue
- Returns:
- the value as a
IsoDuration
, if possible
-
asPoint
Description copied from interface:Value
Returns the value as aPoint
, if possible. -
asByteArray
public byte[] asByteArray()Description copied from interface:Value
Returns the value as a Java byte array, if possible.- Specified by:
asByteArray
in interfaceValue
- Returns:
- the value as a Java byte array, if possible
-
asNumber
Description copied from interface:Value
Returns the value as a Java Number, if possible. -
asEntity
Description copied from interface:Value
Returns the value as aEntity
, if possible. -
asNode
Description copied from interface:Value
Returns the value as aNode
, if possible. -
asPath
Description copied from interface:Value
Returns the value as aPath
, if possible. -
asRelationship
Description copied from interface:Value
Returns the value as aRelationship
, if possible.- Specified by:
asRelationship
in interfaceValue
- Returns:
- the value as a
Relationship
, if possible
-
asLocalDate
Description copied from interface:Value
Returns the value as aLocalDate
, if possible.- Specified by:
asLocalDate
in interfaceValue
- Returns:
- the value as a
LocalDate
, if possible
-
asOffsetTime
Description copied from interface:Value
Returns the value as aOffsetTime
, if possible.- Specified by:
asOffsetTime
in interfaceValue
- Returns:
- the value as a
OffsetTime
, if possible
-
asLocalTime
Description copied from interface:Value
Returns the value as aLocalTime
, if possible.- Specified by:
asLocalTime
in interfaceValue
- Returns:
- the value as a
LocalTime
, if possible
-
asLocalDateTime
Description copied from interface:Value
Returns the value as aLocalDateTime
, if possible.- Specified by:
asLocalDateTime
in interfaceValue
- Returns:
- the value as a
LocalDateTime
, if possible
-
asOffsetDateTime
Description copied from interface:Value
Returns the value as aOffsetDateTime
, if possible.- Specified by:
asOffsetDateTime
in interfaceValue
- Returns:
- the value as a
OffsetDateTime
, if possible
-
asZonedDateTime
Description copied from interface:Value
Returns the value as aZonedDateTime
, if possible.- Specified by:
asZonedDateTime
in interfaceValue
- Returns:
- the value as a
ZonedDateTime
, if possible
-
asIsoDuration
Description copied from interface:Value
Returns the value as aIsoDuration
, if possible.- Specified by:
asIsoDuration
in interfaceValue
- Returns:
- the value as a
IsoDuration
, if possible
-
asPoint
Description copied from interface:Value
Returns the value as aPoint
, if possible. -
get
Description copied from interface:Value
Retrieve the value at the given index -
get
Description copied from interface:MapAccessor
Retrieve the value of the property with the given key- Specified by:
get
in interfaceMapAccessor
- Specified by:
get
in classInternalMapAccessorWithDefaultValue
- Parameters:
key
- the key of the property- Returns:
- the property's value or a
NullValue
if no such key exists
-
size
public int size()Description copied from interface:Value
If the underlying value is a collection type, return the number of values in the collection.For
TypeSystem.LIST()
list} values, this will return the size of the list.For
map
values, this will return the number of entries in the map.For
node
andTypeSystem.RELATIONSHIP()
relationship} values, this will return the number of properties.For
path
values, this returns the length (number of relationships) in the path.- Specified by:
size
in interfaceMapAccessor
- Specified by:
size
in interfaceValue
- Returns:
- the number of values in an underlying collection
-
keys
Description copied from interface:Value
If the underlying value supportskey-based indexing
, return an iterable of the keys in the map, this applies tomap
,node
andTypeSystem.RELATIONSHIP()
relationship} values.- Specified by:
keys
in interfaceMapAccessor
- Specified by:
keys
in interfaceValue
- Returns:
- the keys in the value
-
isEmpty
public boolean isEmpty()Description copied from interface:Value
If this value represents a list or map, test if the collection is empty. -
values
Description copied from interface:MapAccessor
Retrieve all values of the underlying collection- Specified by:
values
in interfaceMapAccessor
- Returns:
- all values in unspecified order
-
values
Description copied from interface:MapAccessor
Map and retrieve all values of the underlying collection- Specified by:
values
in interfaceMapAccessor
- Type Parameters:
T
- the target type of mapping- Parameters:
mapFunction
- a function to map from Value to T. SeeValues
for some predefined functions, such asValues.ofBoolean()
,Values.ofList(Function)
.- Returns:
- the result of mapping all values in unspecified order
-
typeConstructor
- Specified by:
typeConstructor
in interfaceInternalValue
-
asMapped
-
equals
-
hashCode
public abstract int hashCode() -
toString
-