Class SimpleField<T>

Type Parameters:
T - Java type for the field's values
Direct Known Subclasses:
EnumArrayField, EnumField, ReferenceField

public class SimpleField<T> extends Field<T>
A simple Field.

SimpleFields have these requirements and properties:

  • They have an associated Encoding representing the domain of possible values
  • Theys can serve as the element sub-field for SetFields and ListFields, and the key and value sub-fields for MapFields.
  • They can be indexed.
  • Method Details

    • getEncoding

      public Encoding<T> getEncoding()
      Get the Encoding associated with this field.
      Returns:
      this field's type
    • isIndexed

      public boolean isIndexed()
      Determine whether this field is indexed.
      Returns:
      true if this field is indexed
    • getParentField

      public ComplexField<?> getParentField()
      Get the parent field if this field is a sub-field of a complex field.
      Returns:
      parent field, or null if this is not a sub-field
    • getFullName

      public String getFullName()
      Description copied from class: Field
      Get the full name of this field.

      If the field is a sub-field of a complex field, the full name is the field's name qualified by the parent field name, e.g., "mymap.key". Otherwise, the full is is the same as the name.

      Overrides:
      getFullName in class Field<T>
      Returns:
      this field's full name
    • getIndex

      public SimpleIndex<T> getIndex()
      Get the SimpleIndex on this field.
      Returns:
      the index on this field
      Throws:
      UnknownIndexException - if there is no simple index on this field
    • getCompositeIndexes

      public Set<CompositeIndex> getCompositeIndexes()
      Get the CompositeIndexs that contain this field, if any.
      Returns:
      zero or more CompositeIndex that contain this field
    • setValue

      public void setValue(Transaction tx, ObjId id, T value)
      Set the value of this field in the given object. Does not alter the schema of the object.
      Parameters:
      tx - transaction
      id - object id
      value - new value
      Throws:
      DeletedObjectException - if no object with ID equal to id is found
      StaleTransactionException - if this transaction is no longer usable
      IllegalArgumentException - if tx or id is null
      IllegalArgumentException - if this field is a sub-field of a ComplexField
    • getValue

      public T 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<T>
      Parameters:
      tx - transaction
      id - object id
      Returns:
      this field's value in the specified object
    • 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<T>
      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
    • visit

      public <R> R visit(FieldSwitch<R> target)
      Description copied from class: Field
      Apply visitor pattern.
      Specified by:
      visit in class Field<T>
      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
    • toString

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

      protected boolean remapsObjectId()
    • remapObjectId

      protected T remapObjectId(ObjIdMap<ObjId> objectIdMap, T value)