All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, SchemaProblemsSupplier, JavaCodeGenerator, Serializable, Cloneable

public class IndexFieldDef extends SchemaPart implements Cloneable, SchemaProblemsSupplier, JavaCodeGenerator
The metadata model for a field in an entity's index.
See Also:
  • Constructor Details

    • IndexFieldDef

      public IndexFieldDef()
    • IndexFieldDef

      public IndexFieldDef(String fieldName, boolean ascending)
    • IndexFieldDef

      public IndexFieldDef(String fieldName)
      Creates an ascending index field for the named entity field.
  • Method Details

    • getSchemaProblems

      public void getSchemaProblems(List<SchemaProblem> problems, boolean includeChildren)
      Description copied from interface: SchemaProblemsSupplier
      Adds this element's problems to the list, plus those of its children when includeChildren is true; the default adds none.
      Specified by:
      getSchemaProblems in interface SchemaProblemsSupplier
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
      Specified by:
      generateJavaCode in interface JavaCodeGenerator
    • clone

      public IndexFieldDef clone()
      Overrides:
      clone in class FoundationObject
    • assertValid

      public IndexFieldDef assertValid()
      Description copied from class: FoundationObject
      Throws a DataException if this object is invalid, otherwise returns it; the base implementation checks nothing.
      Overrides:
      assertValid in class FoundationObject
    • getIndexDef

      public IndexDef getIndexDef()
      Returns the index containing this field or null if it has not been added to one.
    • setIndexDef

      protected IndexFieldDef setIndexDef(IndexDef indexDef)
      Sets the parent index; called by IndexDef when this field is added to it.
    • getFieldName

      public String getFieldName()
      Returns the name of the entity field this index field refers to.
    • setFieldName

      public IndexFieldDef setFieldName(String fieldName)
      Sets the name of the entity field this index field refers to.
    • getQualifiedName

      public String getQualifiedName()
      Returns the fully qualified name that includes the name of this index field and all names in its hierarchy separated by period.
    • getIndexQualifiedName

      public String getIndexQualifiedName()
      Returns a qualified name that includes the name of this index field and the IndexDef above it separated by period.
    • getSchemaDef

      public SchemaDef getSchemaDef(boolean throwException)
      Returns the schema of the index's entity; if the index, entity or schema is missing, throws a DataException when throwException is true and returns null otherwise.
    • getSchemaDef

      public SchemaDef getSchemaDef()
      The schema of the parent entity containing this field.
      Specified by:
      getSchemaDef in class SchemaPart
    • getSchemaPartContainer

      public SchemaPart getSchemaPartContainer()
      Description copied from class: SchemaPart
      Returns the schema part containing this one or null if there is none.
      Specified by:
      getSchemaPartContainer in class SchemaPart
    • getSchemaPartType

      public SchemaPartType getSchemaPartType()
      Description copied from class: SchemaPart
      Returns the kind of part this is, such as SchemaPartType.ENTITY.
      Specified by:
      getSchemaPartType in class SchemaPart
    • getSchemaPartName

      public String getSchemaPartName()
      Description copied from class: SchemaPart
      Returns the name identifying this part, such as an entity's name or an index field's field name.
      Specified by:
      getSchemaPartName in class SchemaPart
    • isAscending

      public boolean isAscending()
      Indicates if this field is sorted in ascending order in the index (defaults to true).
    • setAscending

      public IndexFieldDef setAscending(boolean ascending)
      Indicates if this field is sorted in ascending order in the index (defaults to true).
    • getIndexInIndexDef

      public int getIndexInIndexDef()
      Returns the zero-based index of this index field in IndexDef.
    • toJson

      public String toJson()
      Specified by:
      toJson in interface JsonSerializable
      Specified by:
      toJson in interface RecordSerializable
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
    • fromXmlElement

      public IndexFieldDef fromXmlElement(Element fieldDefElement)
      Specified by:
      fromXmlElement in interface XmlSerializable
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class Bean
    • fromRecord

      public IndexFieldDef fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class Bean
      Parameters:
      source -
      Returns:
      this instance.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object