Interface IndexKey

All Superinterfaces:
Comparable<FieldValue>, FieldValue, RecordValue

public interface IndexKey extends RecordValue
IndexKey is a specialization of RecordValue to represent a key used to access a specific index defined on a table. It may contain all or part of a the fields associated with the index. If partial the fields must be set in order of significance, as defined by the list returned by getFields(). If an attempt is made to set a field that is not part of the index IllegalArgumentException is thrown.

IndexKey instances do not share the same RecordDef definition as the corresponding Row objects on the same table. Instead, they have a flattened name space, simplifying their use. Values for fields in an IndexKey can be created using a positional put, RecordValue.put(int, FieldValue), or by name, where the name must be one of the strings returned by getFields().

IndexKey objects are constructed using Index.createIndexKey()}, and Index.createIndexKeyFromJson(java.lang.String, boolean).

Since:
3.0
  • Method Details

    • getIndex

      Index getIndex()
      Returns the Index associated with this key.
      Returns:
      the Index
    • getFields

      @Deprecated List<String> getFields()
      Deprecated.
      as of 4.2 Please use the equivalent getFieldNames() method.
      Returns an unmodifiable list of fields, in key order, that comprise this key. This method returns the same list as Index.getFields() for this instance's Index.
      Specified by:
      getFields in interface RecordValue
      Returns:
      the fields
      Since:
      3.0.6
    • putEMPTY

      IndexKey putEMPTY(int position)
      Inserts the field at the given position, or updates its value if the field exists already. The new value of the field will be the special EMPTY value that returns true for FieldValue.isEMPTY().
      Parameters:
      position - the position of the field.
      Returns:
      this
      Throws:
      IndexOutOfBoundsException - if position is negative or greater or equal to the number of fields in the record type definition associated with this record.
      Since:
      4.4
    • putEMPTY

      IndexKey putEMPTY(String fieldName)
      Puts an EMPTY value in the named field, silently overwriting existing values. EMPTY is a special value that returns true for FieldValue.isEMPTY().
      Parameters:
      fieldName - name of the desired field
      Returns:
      this
      Since:
      4.4