oracle.kv.table

## Interface Index

-     public interface Index

  Index represents an index on a table in Oracle NoSQL Database. It is an immutable object created from system metadata. Index is used to examine index metadata and used as a factory for `IndexKey` objects used for IndexKey operations in `TableAPI`.

  Indexes are created and managed using the administrative command line interface.

  Since:
    3.0

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FieldRange` | `createFieldRange(String fieldName)` Creates a `FieldRange` object used to specify a value range for use in a index iteration operation in `TableAPI`.
    `IndexKey` | `createIndexKey()` Creates an `IndexKey` for this index.
    `IndexKey` | `createIndexKey(RecordValue value)` Creates an `IndexKey` for the index populated relevant fields from the `RecordValue` parameter.
    `IndexKey` | `createIndexKeyFromJson(InputStream jsonInput, boolean exact)` Creates an `IndexKey` based on JSON input.
    `IndexKey` | `createIndexKeyFromJson(String jsonInput, boolean exact)` Creates an `IndexKey` based on JSON input.
    `String` | `getDescription()` Gets the index's description if present, otherwise null.
    `List<String>` | `getFields()` Returns an unmodifiable list of the field names that define the index.
    `String` | `getName()` Returns the name of the index.
    `Table` | `getTable()` Returns the Table on which the index is defined.

- - ### Method Detail

    - #### getTable

          Table getTable()

      Returns the Table on which the index is defined.
      Returns:
        the table

    - #### getName

          String getName()

      Returns the name of the index.
      Returns:
        the index name

    - #### getFields

          List<String> getFields()

      Returns an unmodifiable list of the field names that define the index. These are in order of declaration which is significant.
      Returns:
        the field names

    - #### getDescription

          String getDescription()

      Gets the index's description if present, otherwise null. This is a description of the index that is optionally supplied during definition of the index.
      Returns:
        the description or null

    - #### createIndexKey

          IndexKey createIndexKey()

      Creates an `IndexKey` for this index. The returned key can only hold fields that are part of this. Other fields are rejected if an attempt is made to set them on the returned object.
      Returns:
        an empty index key based on the index

    - #### createIndexKey

          IndexKey createIndexKey(RecordValue value)

      Creates an `IndexKey` for the index populated relevant fields from the `RecordValue` parameter. Fields that are not part of the index key are silently ignored.
      Parameters:
        `value` - a `RecordValue` instance
      Returns:
        an `IndexKey` containing relevant fields from the value

    - #### createIndexKeyFromJson

          IndexKey createIndexKeyFromJson(String jsonInput,
                                        boolean exact)

      Creates an `IndexKey` based on JSON input. If the `exact` parameter is true the input string must contain an exact match to the index key. It must not have additional data. If false, only matching fields will be added and the input may have additional, unrelated data.
      Parameters:
        `jsonInput` - a JSON string
        `exact` - set to true for an exact match. See above
      Throws:
        `IllegalArgumentException` - if exact is true and a field is missing or extra. It will also be thrown if a field type or value is not correct
        `IllegalArgumentException` - if the input is malformed

    - #### createIndexKeyFromJson

          IndexKey createIndexKeyFromJson(InputStream jsonInput,
                                        boolean exact)

      Creates an `IndexKey` based on JSON input. If the `exact` parameter is true the input string must contain an exact match to the index key. It must not have additional data. If false, only matching fields will be added and the input may have additional, unrelated data.
      Parameters:
        `jsonInput` - a JSON string
        `exact` - set to true for an exact match. See above
      Throws:
        `IllegalArgumentException` - if exact is true and a field is missing or extra. It will also be thrown if a field type or value is not correct
        `IllegalArgumentException` - if the input is malformed

    - #### createFieldRange

          FieldRange createFieldRange(String fieldName)

      Creates a `FieldRange` object used to specify a value range for use in a index iteration operation in `TableAPI`.
      Parameters:
        `fieldName` - the name of the field from the index to use for the range
      Returns:
        an empty `FieldRange` based on the index
      Throws:
        `IllegalArgumentException` - if the field is not defined in the index

Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.