public abstract class Index extends JsonSerializable
Modifier | Constructor and Description |
---|---|
protected |
Index(IndexKind indexKind)
Constructor.
|
protected |
Index(org.json.JSONObject jsonObject,
IndexKind indexKind)
Constructor.
|
protected |
Index(String jsonString,
IndexKind indexKind)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
IndexKind |
getKind()
Gets index kind.
|
static HashIndex |
Hash(DataType dataType)
Returns an instance of HashIndex class with specified DataType.
|
static HashIndex |
Hash(DataType dataType,
int precision)
Returns an instance of HashIndex class with specified DataType and precision.
|
static RangeIndex |
Range(DataType dataType)
Returns an instance of RangeIndex class with specified DataType.
|
static RangeIndex |
Range(DataType dataType,
int precision)
Returns an instance of RangeIndex class with specified DataType and precision.
|
static SpatialIndex |
Spatial(DataType dataType)
Returns an instance of SpatialIndex class with specified DataType.
|
get, getBoolean, getCollection, getCollection, getDouble, getHashMap, getInt, getLogger, getLong, getMapper, getObject, getObject, getObjectByPath, getString, has, remove, set, toJson, toJson, toObject, toString
protected Index(IndexKind indexKind)
indexKind
- the kind of the indexprotected Index(String jsonString, IndexKind indexKind)
jsonString
- the json string that represents the index.indexKind
- the kind of the indexprotected Index(org.json.JSONObject jsonObject, IndexKind indexKind)
jsonObject
- the json object that represents the index.indexKind
- the kind of the indexpublic static RangeIndex Range(DataType dataType)
Here is an example to create RangeIndex instance passing in the DataType:
RangeIndex rangeIndex = Index.Range(DataType.Number);
dataType
- the data type.public static RangeIndex Range(DataType dataType, int precision)
Here is an example to create RangeIndex instance passing in the DataType and precision:
RangeIndex rangeIndex = Index.Range(DataType.Number, -1);
dataType
- specifies the target data type for the index path specification.precision
- specifies the precision to be used for the data type associated with this index.public static HashIndex Hash(DataType dataType)
Here is an example to create HashIndex instance passing in the DataType:
HashIndex hashIndex = Index.Hash(DataType.String);
dataType
- specifies the target data type for the index path specification.public static HashIndex Hash(DataType dataType, int precision)
Here is an example to create HashIndex instance passing in the DataType and precision:
HashIndex hashIndex = Index.Hash(DataType.String, 3);
dataType
- specifies the target data type for the index path specification.precision
- specifies the precision to be used for the data type associated with this index.public static SpatialIndex Spatial(DataType dataType)
Here is an example to create SpatialIndex instance passing in the DataType:
SpatialIndex spatialIndex = Index.Spatial(DataType.Point);
dataType
- specifies the target data type for the index path specification.public IndexKind getKind()
Copyright © 2018. All rights reserved.