Package com.yahoo.document.annotation
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:
java.lang.Cloneable
,java.lang.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:
Annotation.setFieldValue(com.yahoo.document.datatypes.FieldValue)
-
-
Field Summary
Fields Modifier and Type Field Description static int
classId
-
Constructor Summary
Constructors Constructor Description AnnotationReference(AnnotationReferenceDataType type)
Constructs a new AnnotationReference.AnnotationReference(AnnotationReferenceDataType type, Annotation reference)
Constructs a new AnnotationReference, with a reference to the givenAnnotation
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(java.lang.Object o)
Assign this non-fieldvalue value to this field value.void
clear()
AnnotationReference
clone()
Clones this AnnotationReference. Note: No deep-copying, so the AnnotationReference returned refers to the same Annotation as this AnnotationReference.int
compareTo(FieldValue fieldValue)
void
deserialize(Field field, FieldReader reader)
Read a field value from the specified readerboolean
equals(java.lang.Object o)
AnnotationReferenceDataType
getDataType()
Annotation
getReference()
Returns the Annotation that this AnnotationReference refers to.int
hashCode()
void
printXml(XmlStream xml)
void
serialize(Field field, FieldWriter writer)
Write out field value to the specified writervoid
setDataType(DataType dataType)
void
setReference(Annotation reference)
Set anAnnotation
that this AnnotationReference shall refer to.void
setReferenceNoCompatibilityCheck(Annotation reference)
WARNING! Only to be used by deserializers when reference is not fully deserialized yet! Sets anAnnotation
that this AnnotationReference shall refer to.java.lang.String
toString()
-
Methods inherited from class com.yahoo.document.datatypes.FieldValue
create, deserialize, getRecursiveValue, getRecursiveValue, getWrappedValue, onDeserialize, onSerialize, serialize, toXml
-
-
-
-
Constructor Detail
-
AnnotationReference
public AnnotationReference(AnnotationReferenceDataType type, Annotation reference)
Constructs a new AnnotationReference, with a reference to the givenAnnotation
.- Parameters:
type
- the data type of this AnnotationReferencereference
- the reference to set- Throws:
java.lang.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 Detail
-
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 classFieldValue
- 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(java.lang.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 classFieldValue
-
setReference
public void setReference(Annotation reference)
Set anAnnotation
that this AnnotationReference shall refer to.- Parameters:
reference
- an Annotation that this AnnotationReference shall refer to.- Throws:
java.lang.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 anAnnotation
that this AnnotationReference shall refer to.- Parameters:
reference
- an Annotation that this AnnotationReference shall refer to.- Throws:
java.lang.IllegalArgumentException
- if the given annotation has a type that is not compatible with this reference
-
getDataType
public AnnotationReferenceDataType getDataType()
- Specified by:
getDataType
in classFieldValue
-
setDataType
public void setDataType(DataType dataType)
-
printXml
public void printXml(XmlStream xml)
- Specified by:
printXml
in classFieldValue
-
clear
public void clear()
- Specified by:
clear
in classFieldValue
-
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 classFieldValue
-
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 classFieldValue
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classcom.yahoo.vespa.objects.Identifiable
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.yahoo.vespa.objects.Identifiable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classcom.yahoo.vespa.objects.Identifiable
-
compareTo
public int compareTo(FieldValue fieldValue)
- Specified by:
compareTo
in interfacejava.lang.Comparable<FieldValue>
- Overrides:
compareTo
in classFieldValue
-
-