public class IndexDef extends SchemaPart implements Cloneable, SchemaProblemsSupplier, JavaCodeGenerator
internalId, internalName, log, TIMESTAMP_FORMAT
SERIALIZED_CLASS_NAME, TYPE
XML_SERIALIZED_CLASS_NAME
Constructor and Description |
---|
IndexDef() |
IndexDef(String name,
String... indexFieldNames) |
Modifier and Type | Method and Description |
---|---|
IndexDef |
addIndexField(IndexFieldDef indexField) |
IndexDef |
addIndexFields(String... indexFieldNames) |
IndexDef |
clone() |
boolean |
containsField(String name)
Returns true if this index contains an
IndexFieldDef with the specified name . |
boolean |
equals(Object obj) |
IndexDef |
fromRecord(Record source)
Loads this instance's state from a record and returns
this (for fluid API call chaining). |
IndexDef |
fromXmlElement(Element indexDefElement) |
void |
generateJavaCode(JavaCodeBuilder code) |
String |
getDescription() |
EntityDef |
getEntityDef() |
String |
getEntityQualifiedName()
Returns the qualified name that includes the name of this index and the
EntityDef above it separated by period. |
IndexFieldDef |
getIndexField(String name)
Returns the
IndexFieldDef that matches the specified name. |
int |
getIndexFieldCount()
Returns the number of index fields in this index.
|
List<String> |
getIndexFieldNames()
Returns the names of all index fields in this index.
|
List<IndexFieldDef> |
getIndexFields() |
List<IndexFieldDef> |
getIndexFields(boolean create) |
String |
getName() |
String |
getQualifiedName()
Returns the fully qualified name that includes the name of this index and all names in its hierarchy separated by period.
|
SchemaDef |
getSchemaDef()
The schema of the parent entity containing this field.
|
SchemaDef |
getSchemaDef(boolean throwException) |
SchemaPart |
getSchemaPartContainer() |
String |
getSchemaPartName() |
SchemaPartType |
getSchemaPartType() |
void |
getSchemaProblems(List<SchemaProblem> problems,
boolean includeChildren) |
int |
hashCode() |
int |
indexOfField(String indexFieldName)
Returns the zero-based position of the
IndexDef with the specified name or -1 if it is not found. |
int |
indexOfField(String indexFieldName,
boolean throwExceptionOnFailure)
Returns the zero-based position of the
IndexFieldDef with the specified name or -1 if it is not found and throwExceptionOnFailure is false, otherwise a DataException is thrown. |
boolean |
isPrimaryKeyIndex() |
boolean |
isUnique() |
void |
moveField(int oldIndex,
int newIndex)
Moves the index field at the
oldIndex to the newIndex , shifting any existing elements at or after newIndex to the right. |
void |
moveField(String fieldName,
int newIndex)
Moves the index field with the given name to the
newIndex , shifting any existing elements at or after newIndex to the right. |
void |
moveFieldAfter(String fieldName,
String afterFieldName)
Moves the index field with the given
fieldName after to the index field with the specified afterFieldName , shifting any existing elements after afterFieldName to the right. |
void |
moveFieldBefore(String fieldName,
String beforeFieldName)
Moves the index field with the given
fieldName before to the index field with the specified beforeFieldName , shifting elements at or after beforeFieldName to the right. |
IndexDef |
setDescription(String description) |
protected IndexDef |
setEntityDef(EntityDef entityDef) |
IndexDef |
setIndexFields(List<IndexFieldDef> indexFields) |
IndexDef |
setName(String name) |
IndexDef |
setUnique(boolean unique) |
String |
toJson() |
Record |
toRecord() |
Element |
toXmlElement(Document document) |
getSchemaName, getSchemaPartContainerName, getSchemaPartContainerType
addExceptionProperties, assertValid, assertValid, exception, exception, exception, getInternalId, getInternalName, resetInternalId
finalize, getClass, notify, notifyAll, wait, wait, wait
getSchemaProblems, getSchemaProblems
fromArrayValue, fromArrayValue, fromArrayValue, fromJson, fromJson, newInstanceFromRecord, newInstanceFromRecord, toArrayValue, toJson, toJson, toRecord
newInstanceFromJson
forEachGrandChildElement, fromXml, fromXml, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getChildElement, getChildElements, newInstanceFromXml, newInstanceFromXml, setAttribute, toXml, toXml, toXml, toXml, toXml, writeXml, writeXml
addExceptionProperties, contributeExceptionProperties, contributeExceptionProperties
public void getSchemaProblems(List<SchemaProblem> problems, boolean includeChildren)
getSchemaProblems
in interface SchemaProblemsSupplier
public IndexDef clone()
clone
in class FoundationObject
public void generateJavaCode(JavaCodeBuilder code)
generateJavaCode
in interface JavaCodeGenerator
public SchemaDef getSchemaDef(boolean throwException)
public SchemaDef getSchemaDef()
getSchemaDef
in class SchemaPart
public SchemaPart getSchemaPartContainer()
getSchemaPartContainer
in class SchemaPart
public SchemaPartType getSchemaPartType()
getSchemaPartType
in class SchemaPart
public String getSchemaPartName()
getSchemaPartName
in class SchemaPart
public EntityDef getEntityDef()
public String getName()
public String getQualifiedName()
public String getEntityQualifiedName()
EntityDef
above it separated by period.public String getDescription()
public boolean isUnique()
public IndexDef setUnique(boolean unique)
public boolean isPrimaryKeyIndex()
public boolean containsField(String name)
IndexFieldDef
with the specified name
.public int getIndexFieldCount()
public List<String> getIndexFieldNames()
public List<IndexFieldDef> getIndexFields(boolean create)
public IndexFieldDef getIndexField(String name)
IndexFieldDef
that matches the specified name.public List<IndexFieldDef> getIndexFields()
public IndexDef setIndexFields(List<IndexFieldDef> indexFields)
public IndexDef addIndexField(IndexFieldDef indexField)
public Element toXmlElement(Document document)
toXmlElement
in interface XmlSerializable
public IndexDef fromXmlElement(Element indexDefElement)
fromXmlElement
in interface XmlSerializable
public String toJson()
toJson
in interface JsonSerializable
toJson
in interface RecordSerializable
public Record toRecord()
toRecord
in interface RecordSerializable
toRecord
in class Bean
public IndexDef fromRecord(Record source)
RecordSerializable
this
(for fluid API call chaining).
For fluid API call chaining, the overridden method should change the declared return type to its class.fromRecord
in interface RecordSerializable
fromRecord
in class Bean
public int indexOfField(String indexFieldName)
IndexDef
with the specified name or -1 if it is not found.public int indexOfField(String indexFieldName, boolean throwExceptionOnFailure)
IndexFieldDef
with the specified name or -1 if it is not found and throwExceptionOnFailure
is false, otherwise a DataException
is thrown.public void moveField(int oldIndex, int newIndex)
oldIndex
to the newIndex
, shifting any existing elements at or after newIndex
to the right.public void moveField(String fieldName, int newIndex)
newIndex
, shifting any existing elements at or after newIndex
to the right.public void moveFieldBefore(String fieldName, String beforeFieldName)
fieldName
before to the index field with the specified beforeFieldName
, shifting elements at or after beforeFieldName
to the right.Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.