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:
Cloneable
,Comparable<FieldValue>
A FieldValue which holds a reference to an annotation of a specified type.
- Author:
- Einar M R Rosenvinge
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new AnnotationReference.AnnotationReference
(AnnotationReferenceDataType type, Annotation reference) Constructs a new AnnotationReference, with a reference to the givenAnnotation
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Assign this non-fieldvalue value to this field value.void
clear()
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
Returns the Annotation that this AnnotationReference refers to.int
hashCode()
void
Deprecated.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.toString()
Methods inherited from class com.yahoo.document.datatypes.FieldValue
create, deserialize, getRecursiveValue, getRecursiveValue, getWrappedValue, onDeserialize, onSerialize, serialize, toXml
Methods inherited from class com.yahoo.vespa.objects.Identifiable
create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, onGetClassId, putUtf8, registerClass, registerClass, serialize, serializeOptional, serializeWithId, visitMembers
Methods inherited from class com.yahoo.vespa.objects.Selectable
select, select, selectMembers
-
Field Details
-
classId
public static int classId
-
-
Constructor Details
-
AnnotationReference
Constructs a new AnnotationReference, with a reference to the givenAnnotation
.- Parameters:
type
- the data type of this AnnotationReferencereference
- the reference to set- Throws:
IllegalArgumentException
- if the given annotation has a type that is not compatible with this reference
-
AnnotationReference
Constructs a new AnnotationReference.- Parameters:
type
- the data type of this AnnotationReference
-
-
Method Details
-
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
Returns the Annotation that this AnnotationReference refers to.- Returns:
- the Annotation that this AnnotationReference refers to.
-
assign
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
Set anAnnotation
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
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:
IllegalArgumentException
- if the given annotation has a type that is not compatible with this reference
-
getDataType
- Specified by:
getDataType
in classFieldValue
-
setDataType
-
printXml
Deprecated.- Specified by:
printXml
in classFieldValue
-
clear
public void clear()- Specified by:
clear
in classFieldValue
-
serialize
Description copied from class:FieldValue
Write out field value to the specified writer- Specified by:
serialize
in classFieldValue
-
deserialize
Description copied from class:FieldValue
Read a field value from the specified reader- Specified by:
deserialize
in classFieldValue
-
equals
- Overrides:
equals
in classcom.yahoo.vespa.objects.Identifiable
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.yahoo.vespa.objects.Identifiable
-
toString
- Overrides:
toString
in classcom.yahoo.vespa.objects.Identifiable
-
compareTo
- Specified by:
compareTo
in interfaceComparable<FieldValue>
- Overrides:
compareTo
in classFieldValue
-