Package com.yahoo.document.annotation
Class Annotation
java.lang.Object
com.yahoo.document.annotation.Annotation
- All Implemented Interfaces:
Comparable<Annotation>
An Annotation describes some kind of information associated with a
SpanNode.- Author:
- Einar M R Rosenvinge
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an Annotation without a type.Annotation(Annotation other) Constructs a copy of the input annotation.Annotation(AnnotationType type) Constructs a new annotation of the specified type.Annotation(AnnotationType type, FieldValue value) Constructs a new annotation of the specified type, and having the specified value. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(Annotation annotation) booleanReturns the value of the annotation, if any.intReturns theSpanNodethis Annotation is annotating, if any.final SpanNodeReturns theSpanNodethis Annotation is annotating, if any.getType()Returns the type of this annotation.booleanReturns true if this Annotation has a value.inthashCode()booleanReturns true if this Annotation is associated with a SpanNode (irrespective of the SpanNode being valid or not).booleanReturns true iff this Annotation is associated with a SpanNode and the SpanNode is valid.voidsetFieldValue(FieldValue fieldValue) Sets the value of the annotation.voidsetScratchId(int id) voidsetSpanNode(SpanNode spanNode) WARNING!final voidsetSpanNodeFast(SpanNode spanNode) WARNING!voidsetType(AnnotationType type) Sets the type of this annotation.toString()
-
Constructor Details
-
Annotation
public Annotation()Constructs an Annotation without a type. BEWARE! Should only be used during deserialization. -
Annotation
Constructs a new annotation of the specified type.- Parameters:
type- the type of the new annotation
-
Annotation
Constructs a copy of the input annotation.- Parameters:
other- annotation
-
Annotation
Constructs a new annotation of the specified type, and having the specified value.- Parameters:
type- the type of the new annotationvalue- the value of the new annotation- Throws:
UnsupportedOperationException- if the annotation type does not allow this annotation to have values.
-
-
Method Details
-
setScratchId
public void setScratchId(int id) -
getScratchId
public int getScratchId() -
getType
Returns the type of this annotation.- Returns:
- the type of this annotation
-
setType
Sets the type of this annotation. BEWARE! Should only be used during deserialization.- Parameters:
type- the type of this annotation
-
hasSpanNode
public boolean hasSpanNode()Returns true if this Annotation is associated with a SpanNode (irrespective of the SpanNode being valid or not).- Returns:
- true if this Annotation is associated with a SpanNode, false otherwise.
- See Also:
-
isSpanNodeValid
public boolean isSpanNodeValid()Returns true iff this Annotation is associated with a SpanNode and the SpanNode is valid.- Returns:
- true iff this Annotation is associated with a SpanNode and the SpanNode is valid.
- See Also:
-
getSpanNode
Returns theSpanNodethis Annotation is annotating, if any.- Returns:
- the
SpanNodethis Annotation is annotating, or null - Throws:
IllegalStateException- if this Annotation is associated with a SpanNode and the SpanNode is invalid.
-
getSpanNodeFast
Returns theSpanNodethis Annotation is annotating, if any.- Returns:
- the
SpanNodethis Annotation is annotating, or null
-
setSpanNode
WARNING! Should only be used by deserializers! Sets the span node that this annotation points to.- Parameters:
spanNode- the span node that this annotation shall point to.
-
setSpanNodeFast
WARNING! Should only be used by deserializers! Sets the span node that this annotation points to.- Parameters:
spanNode- the span node that this annotation shall point to.
-
getFieldValue
Returns the value of the annotation, if any. -
setFieldValue
Sets the value of the annotation.- Parameters:
fieldValue- the value to set- Throws:
UnsupportedOperationException- if the annotation type does not allow this annotation to have values.
-
hasFieldValue
public boolean hasFieldValue()Returns true if this Annotation has a value.- Returns:
- true if this Annotation has a value, false otherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<Annotation>
-