Interface MapAccessor

All Known Subinterfaces:
Entity, InternalValue, MapAccessorWithDefaultValue, Node, Record, Relationship, Value
All Known Implementing Classes:
BooleanValue, BytesValue, DateTimeValue, DateValue, DurationValue, EntityValueAdapter, FloatValue, IntegerValue, InternalMapAccessorWithDefaultValue, ListValue, LocalDateTimeValue, LocalTimeValue, MapValue, NodeValue, NullValue, NumberValueAdapter, ObjectValueAdapter, PathValue, PointValue, RelationshipValue, StringValue, TimeValue, UnsupportedDateTimeValue, ValueAdapter

public interface MapAccessor
Access the keys, properties and values of an underlying unordered map by key

This provides only read methods. Subclasses may choose to provide additional methods for changing the underlying map.

Since:
1.0
  • Method Details

    • keys

      Iterable<String> keys()
      Retrieve the keys of the underlying map
      Returns:
      all map keys in unspecified order
    • containsKey

      boolean containsKey(String key)
      Check if the list of keys contains the given key
      Parameters:
      key - the key
      Returns:
      true if this map keys contains the given key otherwise false
    • get

      Value get(String key)
      Retrieve the value of the property with the given key
      Parameters:
      key - the key of the property
      Returns:
      the property's value or a NullValue if no such key exists
      Throws:
      ClientException - if record has not been initialized
    • size

      int size()
      Retrieve the number of entries in this map
      Returns:
      the number of entries in this map
    • values

      Iterable<Value> values()
      Retrieve all values of the underlying collection
      Returns:
      all values in unspecified order
    • values

      <T> Iterable<T> values(Function<Value,T> mapFunction)
      Map and retrieve all values of the underlying collection
      Type Parameters:
      T - the target type of mapping
      Parameters:
      mapFunction - a function to map from Value to T. See Values for some predefined functions, such as Values.ofBoolean(), Values.ofList(Function).
      Returns:
      the result of mapping all values in unspecified order
    • asMap

      Map<String,Object> asMap()
      Return the underlying map as a map of string keys and values converted using Value.asObject().

      This is equivalent to calling asMap(Function) with Values.ofObject().

      Returns:
      the value as a Java map
    • asMap

      <T> Map<String,T> asMap(Function<Value,T> mapFunction)
      Type Parameters:
      T - the type of map values
      Parameters:
      mapFunction - a function to map from Value to T. See Values for some predefined functions, such as Values.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: