@Immutable public interface Record extends MapAccessorWithDefaultValue
Streams of records are returned from Cypher statement execution, contained
within a StatementResult
.
A record is a form of ordered map and, as such, contained values can be
accessed by either positional index
or textual
key
.
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
asMap()
Return this record as a map, where each value has been converted to a default
java object using
Value.asObject() . |
<T> Map<String,T> |
asMap(Function<Value,T> mapper)
Return this record as a map, where each value has been converted using the provided
mapping function.
|
boolean |
containsKey(String key)
Check if the list of keys contains the given key
|
List<Pair<String,Value>> |
fields()
Retrieve all record fields
|
Value |
get(int index)
Retrieve the value at the given field index
|
Value |
get(String key)
Retrieve the value of the property with the given key
|
int |
index(String key)
Retrieve the index of the field with the given key
|
List<String> |
keys()
Retrieve the keys of the underlying map
|
int |
size()
Retrieve the number of fields in this record
|
List<Value> |
values()
Retrieve the values of the underlying map
|
List<Value> values()
boolean containsKey(String key)
key
- the keyint index(String key)
key
- the give keyget(int)
NoSuchElementException
- if the given key is not from keys()
Value get(String key)
key
- the key of the propertyNullValue
if no such key existsNoSuchRecordException
- if the associated underlying record is not availableValue get(int index)
index
- the index of the valueNullValue
if the index is out of boundsClientException
- if record has not been initializedint size()
Map<String,Object> asMap()
Value.asObject()
.
This is equivalent to calling asMap(Function)
with Values.ofObject()
.<T> Map<String,T> asMap(Function<Value,T> mapper)
Values
.T
- the type to convert tomapper
- the mapping functionfor a long list of built-in conversion functions
List<Pair<String,Value>> fields()
NoSuchRecordException
- if the associated underlying record is not availableCopyright © 2018. All rights reserved.