Package com.datastax.driver.core
Class IndexMetadata
- java.lang.Object
-
- com.datastax.driver.core.IndexMetadata
-
public class IndexMetadata extends Object
An immutable representation of secondary index metadata.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexMetadata.Kind
-
Field Summary
Fields Modifier and Type Field Description static StringCUSTOM_INDEX_OPTION_NAMEThe name of the option used to specify a custom index class name.static StringINDEX_ENTRIES_OPTION_NAMEThe name of the option used to specify that the index is on the collection (map) entries.static StringINDEX_KEYS_OPTION_NAMEThe name of the option used to specify that the index is on the collection (map) keys.static StringTARGET_OPTION_NAMEThe name of the option used to specify the index target (Cassandra 3.0 onwards).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringasCQLQuery()Returns a CQL query representing this index.booleanequals(Object obj)StringgetIndexClassName()The name of the class used to implement the custom index, if it is one.IndexMetadata.KindgetKind()Returns the index kind.StringgetName()Returns the index name.StringgetOption(String name)Return the value for the given option name.TableMetadatagetTable()Returns the metadata of the table this index is part of.StringgetTarget()Returns the index target.inthashCode()booleanisCustomIndex()Returns whether this index is a custom one.
-
-
-
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:
trueif 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,nullotherwise.
-
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.
-
-