Class AnnotationType

java.lang.Object
com.yahoo.document.annotation.AnnotationType
All Implemented Interfaces:
Comparable<AnnotationType>

public class AnnotationType extends Object implements Comparable<AnnotationType>
An AnnotationType describes a certain type of annotations; they are generally distinguished by a name, an id, and an optional data type.

If an AnnotationType has a DataType, this means that Annotations of that type are allowed to have a FieldValue of the given DataType as an optional payload.

Author:
Einar M R Rosenvinge
  • Constructor Details

    • AnnotationType

      public AnnotationType(String name)
      Creates a new annotation type that cannot have values (hence no data type).
      Parameters:
      name - the name of the new annotation type
    • AnnotationType

      public AnnotationType(String name, DataType dataType)
      Creates a new annotation type that can have values of the specified type.
      Parameters:
      name - the name of the new annotation type
      dataType - the data type of the annotation value
    • AnnotationType

      public AnnotationType(String name, DataType dataType, int id)
      Creates a new annotation type that can have values of the specified type.
      Parameters:
      name - the name of the new annotation type
      dataType - the data type of the annotation value
      id - the ID of the new annotation type
    • AnnotationType

      public AnnotationType(String name, int id)
      Creates a new annotation type, with the specified ID. WARNING! Only to be used by configuration system, do not use!!
      Parameters:
      name - the name of the new annotation type
      id - the ID of the new annotation type
  • Method Details

    • getName

      public String getName()
      Returns the name of this annotation.
    • getDataType

      public DataType getDataType()
      Returns the data type of this annotation, if any.
    • setDataType

      public void setDataType(DataType dataType)
      Sets the data type of this annotation. WARNING! Only to be used by configuration system, do not use!!
      Parameters:
      dataType - the data type of the annotation value
    • getId

      public int getId()
      Returns the ID of this annotation.
    • isValueCompatible

      public boolean isValueCompatible(Annotation structValue)
    • inherit

      public void inherit(AnnotationType type)
      WARNING! Only to be used by the configuration system and in unit tests. Not to be used in production code.
      Parameters:
      type - the type to inherit from
    • getInheritedTypes

      public Collection<AnnotationType> getInheritedTypes()
    • inherits

      public boolean inherits(AnnotationType type)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(AnnotationType annotationType)
      Specified by:
      compareTo in interface Comparable<AnnotationType>