public abstract class PotentialAnnotation extends Object
annotatedWith() methods.| Modifier and Type | Class and Description |
|---|---|
static interface |
PotentialAnnotation.Visitor<T>
A visitor interface to examine a
PotentialAnnotation's annotation, if it exists. |
| Modifier and Type | Method and Description |
|---|---|
abstract <T> T |
accept(PotentialAnnotation.Visitor<T> visitor)
Accept a
PotentialAnnotation.Visitor. |
PotentialAnnotation |
annotatedWith(Annotation annotation)
Add an annotation.
|
PotentialAnnotation |
annotatedWith(Class<? extends Annotation> annotationType)
Add an annotation.
|
abstract boolean |
equals(Object o) |
static PotentialAnnotation |
from(Key<?> key)
Extract the annotation from a
Key. |
<T> Key<T> |
getKey(Class<T> type)
Create a
Key with the given type and the stored annotation. |
abstract <T> Key<T> |
getKey(TypeLiteral<T> type)
Create a
Key with the given type and the stored annotation. |
abstract boolean |
hasAnnotation() |
abstract int |
hashCode() |
static PotentialAnnotation |
none() |
abstract String |
toString() |
public static PotentialAnnotation none()
PotentialAnnotation with no annotation.public static PotentialAnnotation from(Key<?> key)
Key.key - The Key whose annotation to use, if any.PotentialAnnotation with the annotation from key.public PotentialAnnotation annotatedWith(Class<? extends Annotation> annotationType)
annotationType - The annotation type to add.PotentialAnnotation associated with the given annotation type.CreationException - If an annotation is already present.public PotentialAnnotation annotatedWith(Annotation annotation)
annotation - The annotation instance to add.PotentialAnnotation associated with the given annotation instance.CreationException - If an annotation is already present.public abstract boolean hasAnnotation()
public <T> Key<T> getKey(Class<T> type)
Key with the given type and the stored annotation.T - The type of the key to create.type - The type of the key to create.Key.public abstract <T> Key<T> getKey(TypeLiteral<T> type)
Key with the given type and the stored annotation.T - The type of the key to create.type - The type of the key to create.Key.public abstract <T> T accept(PotentialAnnotation.Visitor<T> visitor)
PotentialAnnotation.Visitor.T - The type for the visitor to return.visitor - The visitor to accept.Copyright © 2014–2015. All rights reserved.