com.languagecomputer.api.text
Class AnnotationType<T extends Text>

java.lang.Object
  extended by com.languagecomputer.api.text.AnnotationType<T>
Type Parameters:
T - The Text sub-class that a AnnotationType represents.

public class AnnotationType<T extends Text>
extends Object

Identifier for a particular type of annotation. Wraps a String descriptor of an annotation. Allows for a hierarchical arrangement of annotations. This allows for a more detailed description of an annotation than the subclass of Text to which it belongs. However, all AnnotationTypes should be children of the base type for the subclass of Text from which is derives.

For example, if you create your own type of Entity, you can give it the special type Entity::MyEntity without subclassing the Entity class. If you only wanted to retrieve your entity from a Document containing other types of entities, you can call #getAnnotations(AnnotationType) with that type. Alternatively, you can call that method with the annotation type Entity to get all entities, including your own type.

Since:
1.0
Author:
Kirk Roberts

Constructor Summary
AnnotationType(String value)
          Creates a new AnnotationType with the given value.
 
Method Summary
 boolean equals(Object o)
          Indicates that the given Object is an AnnotationType exactly equal to this one.
 int hashCode()
          hashCode implementation for an AnnotationType.
 boolean matches(AnnotationType that)
          Indicates if the given AnnotationType is equal to or is a super-type of this one.
 String toString()
          Returns a String representation of this AnnotationType.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationType

public AnnotationType(String value)
Creates a new AnnotationType with the given value.

Parameters:
value - The String value to use for this AnnotationType.
Throws:
IllegalArgumentException - If the given value is either null or empty, or if any of the component items is empty.
Method Detail

matches

public boolean matches(AnnotationType that)
Indicates if the given AnnotationType is equal to or is a super-type of this one.

Parameters:
that - The AnnotationType to compare.
Returns:
true if that AnnotationType is equal to or less specific that this AnnotationType, false otherwise.

equals

public boolean equals(Object o)
Indicates that the given Object is an AnnotationType exactly equal to this one.

Overrides:
equals in class Object
Parameters:
o - The Object to compare for equality.
Returns:
true if o is an AnnotationType exactly equal to this one, false otherwise.

hashCode

public int hashCode()
hashCode implementation for an AnnotationType.

Overrides:
hashCode in class Object
Returns:
A hash code value for this AnnotationType.

toString

public String toString()
Returns a String representation of this AnnotationType. This is the same value as what was given to the constructor.

Overrides:
toString in class Object
Returns:
A String representation of this AnnotationType.


Copyright © 2009. All Rights Reserved.