# Annotation

public class **Annotation** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
An Annotation object is used as a wrapper for a text attribute value if
the attribute has annotation characteristics. These characteristics are:

- The text range that the attribute is applied to is critical to the semantics of the range. That means, the attribute cannot be applied to subranges of the text range that it applies to, and, if two adjacent text ranges have the same value for this attribute, the attribute still cannot be applied to the combined range as a whole with this value.
- The attribute or its value usually do no longer apply if the underlying text is changed.

An example is grammatical information attached to a sentence: For the previous sentence, you can say that "an example" is the subject, but you cannot say the same about "an", "example", or "exam". When the text is changed, the grammatical information typically becomes invalid. Another example is Japanese reading information (yomi).


Wrapping the attribute value into an Annotation object guarantees that
adjacent text runs don't get merged even if the attribute values are equal,
and indicates to text containers that the attribute should be discarded if
the underlying text is modified.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/AttributedCharacterIterator.html`

### Public Constructor Summary

|---|---|
|   | [Annotation](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/Annotation.html#Annotation(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) value) Constructs an annotation record with the given value, which may be null. |

### Public Method Summary

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/Annotation.html#getValue())() Returns the value of the attribute, which may be null. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/Annotation.html#toString())() Returns the String representation of this Annotation. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**Annotation**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) value)

Constructs an annotation record with the given value, which
may be null.

##### Parameters

| value | the value of the attribute |
|---|---|

## Public Methods

#### public [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**getValue**
()

Returns the value of the attribute, which may be null.

##### Returns

- the value of the attribute

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns the String representation of this Annotation.

##### Returns

- the `String` representation of this `Annotation`