Package com.yahoo.document.annotation
Class AnnotationType
java.lang.Object
com.yahoo.document.annotation.AnnotationType
- All Implemented Interfaces:
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 Annotation
s of
that type are allowed to have a FieldValue
of the given
DataType
as an optional payload.
- Author:
- Einar M R Rosenvinge
-
Constructor Summary
ConstructorDescriptionAnnotationType
(String name) Creates a new annotation type that cannot have values (hence no data type).AnnotationType
(String name, int id) Creates a new annotation type, with the specified ID.AnnotationType
(String name, DataType dataType) Creates a new annotation type that can have values of the specified type.AnnotationType
(String name, DataType dataType, int id) Creates a new annotation type that can have values of the specified type. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(AnnotationType annotationType) boolean
Returns the data type of this annotation, if any.int
getId()
Returns the ID of this annotation.getName()
Returns the name of this annotation.int
hashCode()
void
inherit
(AnnotationType type) WARNING! Only to be used by the configuration system and in unit tests.boolean
inherits
(AnnotationType type) boolean
isValueCompatible
(Annotation structValue) void
setDataType
(DataType dataType) Sets the data type of this annotation.toString()
-
Constructor Details
-
AnnotationType
Creates a new annotation type that cannot have values (hence no data type).- Parameters:
name
- the name of the new annotation type
-
AnnotationType
Creates a new annotation type that can have values of the specified type.- Parameters:
name
- the name of the new annotation typedataType
- the data type of the annotation value
-
AnnotationType
Creates a new annotation type that can have values of the specified type.- Parameters:
name
- the name of the new annotation typedataType
- the data type of the annotation valueid
- the ID of the new annotation type
-
AnnotationType
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 typeid
- the ID of the new annotation type
-
-
Method Details
-
getName
Returns the name of this annotation. -
getDataType
Returns the data type of this annotation, if any. -
setDataType
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
-
inherit
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
-
inherits
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AnnotationType>
-