public class Index extends StorableObject
IMPORTANT: The index objects shouldn't be modified directly by outside the owning storage implementation. Use the copy() method to create a copy if changes need to be made elsewhere.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_IDXS
The dictionary key for the array of indices.
|
static java.lang.String |
KEY_MODIFIED
The dictionary key for the last modified date.
|
static java.lang.String |
KEY_OBJS
The dictionary key for the array of objects.
|
static java.lang.String |
KEY_PATH
The dictionary key for the storage path.
|
dict, KEY_CLASSNAME, KEY_ID, KEY_TYPE
Constructor and Description |
---|
Index(Path path)
Creates a new empty index.
|
Index(Path path,
Array indices,
Array objects)
Creates a new index with the specified entries.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addIndex(java.lang.String name)
Adds a sub-index name.
|
boolean |
addObject(java.lang.String name)
Adds an object name.
|
Array |
indices()
Returns an array of sub-index names.
|
java.util.Date |
lastModified()
Returns the last modified date.
|
static Index |
merge(Index one,
Index two)
Merges two index dictionaries.
|
Array |
objects()
Returns an array of object names.
|
Path |
path()
Returns the storage path for the index.
|
Array |
paths()
Returns an array of paths corresponding to all sub-indexes and
objects in this index.
|
boolean |
removeIndex(java.lang.String name)
Removes a sub-index name.
|
boolean |
removeObject(java.lang.String name)
Removes an object name.
|
void |
updateLastModified(java.util.Date date)
Updates the last modified date.
|
public static final java.lang.String KEY_PATH
public static final java.lang.String KEY_MODIFIED
public static final java.lang.String KEY_IDXS
public static final java.lang.String KEY_OBJS
public Index(Path path)
path
- the storage path for the indexpublic static Index merge(Index one, Index two)
one
- the first index dictionarytwo
- the second index dictionarypublic Path path()
path
in class StorableObject
public java.util.Date lastModified()
public void updateLastModified(java.util.Date date)
date
- the date to set, or null for nowpublic Array indices()
public Array objects()
public Array paths()
public boolean addIndex(java.lang.String name)
name
- the index namepublic boolean addObject(java.lang.String name)
name
- the object namepublic boolean removeIndex(java.lang.String name)
name
- the index namepublic boolean removeObject(java.lang.String name)
name
- the object name