Class MapField<K,V>

Type Parameters:
K - Map key type
V - Map value type

public class MapField<K,V> extends ComplexField<NavigableMap<K,V>>
Map field.
  • Field Details

  • Method Details

    • getKeyField

      public SimpleField<K> getKeyField()
      Get the key field.
      Returns:
      map key field
    • getValueField

      public SimpleField<V> getValueField()
      Get the value field.
      Returns:
      map value field
    • getMapKeyIndex

      public MapKeyIndex<K,V> getMapKeyIndex()
      Get the index on this fields's "key" sub-field.
      Returns:
      the index on this field's "key" sub-field
      Throws:
      UnknownIndexException - if there is no index on the "key" sub-field
    • getMapValueIndex

      public MapValueIndex<K,V> getMapValueIndex()
      Get the index on this fields's "value" sub-field.
      Returns:
      the index on this field's "value" sub-field
      Throws:
      UnknownIndexException - if there is no index on the "value" sub-field
    • getSubFields

      public List<SimpleField<?>> getSubFields()
      Description copied from class: ComplexField
      Get the sub-field(s) associated with this instance, ordered according to their meaning.
      Specified by:
      getSubFields in class ComplexField<NavigableMap<K,V>>
      Returns:
      unmodifiable list of simple fields
    • getValue

      public NavigableMap<K,V> getValue(Transaction tx, ObjId id)
      Description copied from class: Field
      Get the value of this field in the given object. Does not alter the schema of the object.
      Specified by:
      getValue in class Field<NavigableMap<K,V>>
      Parameters:
      tx - transaction
      id - object id
      Returns:
      this field's value in the specified object
    • getKey

      public byte[] getKey(ObjId id, K key)
      Get the byte[] key in the underlying key/value store corresponding to this field in the specified object and the specified map key.
      Parameters:
      id - object ID
      key - map key
      Returns:
      the corresponding KVDatabase key
      Throws:
      IllegalArgumentException - if id is null or has the wrong object type
      See Also:
    • hasDefaultValue

      public boolean hasDefaultValue(Transaction tx, ObjId id)
      Description copied from class: Field
      Determine if this field in the specified object has its default value in the specified Transaction.
      Specified by:
      hasDefaultValue in class Field<NavigableMap<K,V>>
      Parameters:
      tx - Transaction containing field state
      id - object ID
      Returns:
      true if this field is set to its initial default value in object id, otherwise false
    • toString

      public String toString()
      Specified by:
      toString in class SchemaItem
    • visit

      public <R> R visit(FieldSwitch<R> target)
      Description copied from class: Field
      Apply visitor pattern.
      Specified by:
      visit in class Field<NavigableMap<K,V>>
      Type Parameters:
      R - visitor return type
      Parameters:
      target - target to invoke
      Returns:
      return value from the method of target corresponding to this instance's type