Class AnnotationReference

java.lang.Object
com.yahoo.vespa.objects.Selectable
com.yahoo.vespa.objects.Identifiable
com.yahoo.document.datatypes.FieldValue
com.yahoo.document.annotation.AnnotationReference
All Implemented Interfaces:
Cloneable, Comparable<FieldValue>

public class AnnotationReference extends FieldValue
A FieldValue which holds a reference to an annotation of a specified type.
Author:
Einar M R Rosenvinge
See Also:
  • Field Details

    • classId

      public static int classId
  • Constructor Details

    • AnnotationReference

      public AnnotationReference(AnnotationReferenceDataType type, Annotation reference)
      Constructs a new AnnotationReference, with a reference to the given Annotation.
      Parameters:
      type - the data type of this AnnotationReference
      reference - the reference to set
      Throws:
      IllegalArgumentException - if the given annotation has a type that is not compatible with this reference
    • AnnotationReference

      public AnnotationReference(AnnotationReferenceDataType type)
      Constructs a new AnnotationReference.
      Parameters:
      type - the data type of this AnnotationReference
  • Method Details

    • clone

      public AnnotationReference clone()
      Clones this AnnotationReference. Note: No deep-copying, so the AnnotationReference returned refers to the same Annotation as this AnnotationReference.
      Overrides:
      clone in class FieldValue
      Returns:
      a copy of this object, referring to the same Annotation instance.
    • getReference

      public Annotation getReference()
      Returns the Annotation that this AnnotationReference refers to.
      Returns:
      the Annotation that this AnnotationReference refers to.
    • assign

      public void assign(Object o)
      Description copied from class: FieldValue
      Assign this non-fieldvalue value to this field value. This is used to be able to assign ints to Integer field values and List to Array field values and such.

      Override to accept the specific types that should be legal.

      Specified by:
      assign in class FieldValue
    • setReference

      public void setReference(Annotation reference)
      Set an Annotation that this AnnotationReference shall refer to.
      Parameters:
      reference - an Annotation that this AnnotationReference shall refer to.
      Throws:
      IllegalArgumentException - if the given annotation has a type that is not compatible with this reference
    • setReferenceNoCompatibilityCheck

      public void setReferenceNoCompatibilityCheck(Annotation reference)
      WARNING! Only to be used by deserializers when reference is not fully deserialized yet! Sets an Annotation that this AnnotationReference shall refer to.
      Parameters:
      reference - an Annotation that this AnnotationReference shall refer to.
      Throws:
      IllegalArgumentException - if the given annotation has a type that is not compatible with this reference
    • getDataType

      public AnnotationReferenceDataType getDataType()
      Specified by:
      getDataType in class FieldValue
    • setDataType

      public void setDataType(DataType dataType)
    • printXml

      @Deprecated public void printXml(XmlStream xml)
      Deprecated.
      Specified by:
      printXml in class FieldValue
    • clear

      public void clear()
      Specified by:
      clear in class FieldValue
    • serialize

      public void serialize(Field field, FieldWriter writer)
      Description copied from class: FieldValue
      Write out field value to the specified writer
      Specified by:
      serialize in class FieldValue
    • deserialize

      public void deserialize(Field field, FieldReader reader)
      Description copied from class: FieldValue
      Read a field value from the specified reader
      Specified by:
      deserialize in class FieldValue
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class com.yahoo.vespa.objects.Identifiable
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.yahoo.vespa.objects.Identifiable
    • toString

      public String toString()
      Overrides:
      toString in class com.yahoo.vespa.objects.Identifiable
    • compareTo

      public int compareTo(FieldValue fieldValue)
      Specified by:
      compareTo in interface Comparable<FieldValue>
      Overrides:
      compareTo in class FieldValue