Class IndexMetadata


  • public class IndexMetadata
    extends Object
    An immutable representation of secondary index metadata.
    • Field Detail

      • TARGET_OPTION_NAME

        public static final String TARGET_OPTION_NAME
        The name of the option used to specify the index target (Cassandra 3.0 onwards).
        See Also:
        Constant Field Values
      • CUSTOM_INDEX_OPTION_NAME

        public static final String CUSTOM_INDEX_OPTION_NAME
        The name of the option used to specify a custom index class name.
        See Also:
        Constant Field Values
      • INDEX_KEYS_OPTION_NAME

        public static final String INDEX_KEYS_OPTION_NAME
        The name of the option used to specify that the index is on the collection (map) keys.
        See Also:
        Constant Field Values
      • INDEX_ENTRIES_OPTION_NAME

        public static final String INDEX_ENTRIES_OPTION_NAME
        The name of the option used to specify that the index is on the collection (map) entries.
        See Also:
        Constant Field Values
    • Method Detail

      • getTable

        public TableMetadata getTable()
        Returns the metadata of the table this index is part of.
        Returns:
        the table this index is part of.
      • getName

        public String getName()
        Returns the index name.
        Returns:
        the index name.
      • getKind

        public IndexMetadata.Kind getKind()
        Returns the index kind.
        Returns:
        the index kind.
      • getTarget

        public String getTarget()
        Returns the index target.
        Returns:
        the index target.
      • isCustomIndex

        public boolean isCustomIndex()
        Returns whether this index is a custom one.

        If it is indeed a custom index, getIndexClassName() will return the name of the class used in Cassandra to implement that index.

        Returns:
        true if this metadata represents a custom index.
      • getIndexClassName

        public String getIndexClassName()
        The name of the class used to implement the custom index, if it is one.
        Returns:
        the name of the class used Cassandra side to implement this custom index if isCustomIndex() == true, null otherwise.
      • getOption

        public String getOption​(String name)
        Return the value for the given option name.
        Parameters:
        name - Option name
        Returns:
        Option value
      • asCQLQuery

        public String asCQLQuery()
        Returns a CQL query representing this index.

        This method returns a single 'CREATE INDEX' query corresponding to this index definition.

        Returns:
        the 'CREATE INDEX' query corresponding to this index.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object