public class Annotations
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Annotations.AnnotationChecker
Checks for the presence of annotations.
|
Modifier and Type | Field and Description |
---|---|
private static Annotations.AnnotationChecker |
bindingAnnotationChecker |
private static com.google.common.cache.LoadingCache<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> |
cache |
private static com.google.common.base.Function<java.lang.Object,java.lang.String> |
DEEP_TO_STRING_FN |
private static com.google.common.base.Joiner.MapJoiner |
JOINER |
private static Annotations.AnnotationChecker |
scopeChecker |
Constructor and Description |
---|
Annotations() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
annotationEquals(java.lang.Class<? extends java.lang.annotation.Annotation> type,
java.util.Map<java.lang.String,java.lang.Object> members,
java.lang.Object other)
Implements
Annotation.equals(java.lang.Object) . |
private static int |
annotationHashCode(java.lang.Class<? extends java.lang.annotation.Annotation> type,
java.util.Map<java.lang.String,java.lang.Object> members)
Implements
Annotation.hashCode() . |
private static java.lang.String |
annotationToString(java.lang.Class<? extends java.lang.annotation.Annotation> type,
java.util.Map<java.lang.String,java.lang.Object> members)
Implements
Annotation.toString() . |
static java.lang.annotation.Annotation |
canonicalizeIfNamed(java.lang.annotation.Annotation annotation)
If the annotation is an instance of
javax.inject.Named , canonicalizes to
com.google.guice.name.Named. |
static java.lang.Class<? extends java.lang.annotation.Annotation> |
canonicalizeIfNamed(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
If the annotation is the class
javax.inject.Named , canonicalizes to
com.google.guice.name.Named. |
static void |
checkForMisplacedScopeAnnotations(java.lang.Class<?> type,
java.lang.Object source,
Errors errors)
Adds an error if there is a misplaced annotations on
type . |
(package private) static boolean |
containsComponentAnnotation(java.lang.annotation.Annotation[] annotations) |
static java.lang.annotation.Annotation |
findBindingAnnotation(Errors errors,
java.lang.reflect.Member member,
java.lang.annotation.Annotation[] annotations)
Returns the binding annotation on
member , or null if there isn't one. |
static java.lang.Class<? extends java.lang.annotation.Annotation> |
findScopeAnnotation(Errors errors,
java.lang.annotation.Annotation[] annotations)
Returns the scoping annotation, or null if there isn't one.
|
static java.lang.Class<? extends java.lang.annotation.Annotation> |
findScopeAnnotation(Errors errors,
java.lang.Class<?> implementation)
Returns the scope annotation on
type , or null if none is specified. |
static <T extends java.lang.annotation.Annotation> |
generateAnnotation(java.lang.Class<T> annotationType)
Generates an Annotation for the annotation class.
|
private static <T extends java.lang.annotation.Annotation> |
generateAnnotationImpl(java.lang.Class<T> annotationType) |
static Key<?> |
getKey(TypeLiteral<?> type,
java.lang.reflect.Member member,
java.lang.annotation.Annotation[] annotations,
Errors errors)
Gets a key for the given type, member and annotations.
|
static boolean |
isAllDefaultMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
static boolean |
isBindingAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns true if annotations of the specified type are binding annotations.
|
static boolean |
isMarker(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns
true if the given annotation type has no attributes. |
static boolean |
isRetainedAtRuntime(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns true if the given annotation is retained at runtime.
|
static boolean |
isScopeAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
private static com.google.common.collect.ImmutableMap<java.lang.String,java.lang.Object> |
resolveMembers(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
private static final com.google.common.cache.LoadingCache<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> cache
private static final com.google.common.base.Joiner.MapJoiner JOINER
private static final com.google.common.base.Function<java.lang.Object,java.lang.String> DEEP_TO_STRING_FN
private static final Annotations.AnnotationChecker scopeChecker
private static final Annotations.AnnotationChecker bindingAnnotationChecker
public static boolean isMarker(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
true
if the given annotation type has no attributes.public static boolean isAllDefaultMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
public static <T extends java.lang.annotation.Annotation> T generateAnnotation(java.lang.Class<T> annotationType)
private static <T extends java.lang.annotation.Annotation> T generateAnnotationImpl(java.lang.Class<T> annotationType)
private static com.google.common.collect.ImmutableMap<java.lang.String,java.lang.Object> resolveMembers(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
private static boolean annotationEquals(java.lang.Class<? extends java.lang.annotation.Annotation> type, java.util.Map<java.lang.String,java.lang.Object> members, java.lang.Object other) throws java.lang.Exception
Annotation.equals(java.lang.Object)
.java.lang.Exception
private static int annotationHashCode(java.lang.Class<? extends java.lang.annotation.Annotation> type, java.util.Map<java.lang.String,java.lang.Object> members) throws java.lang.Exception
Annotation.hashCode()
.java.lang.Exception
private static java.lang.String annotationToString(java.lang.Class<? extends java.lang.annotation.Annotation> type, java.util.Map<java.lang.String,java.lang.Object> members) throws java.lang.Exception
Annotation.toString()
.java.lang.Exception
public static boolean isRetainedAtRuntime(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
public static java.lang.Class<? extends java.lang.annotation.Annotation> findScopeAnnotation(Errors errors, java.lang.Class<?> implementation)
type
, or null if none is specified.public static java.lang.Class<? extends java.lang.annotation.Annotation> findScopeAnnotation(Errors errors, java.lang.annotation.Annotation[] annotations)
static boolean containsComponentAnnotation(java.lang.annotation.Annotation[] annotations)
public static boolean isScopeAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
public static void checkForMisplacedScopeAnnotations(java.lang.Class<?> type, java.lang.Object source, Errors errors)
type
. Scoping
annotations are not allowed on abstract classes or interfaces.public static Key<?> getKey(TypeLiteral<?> type, java.lang.reflect.Member member, java.lang.annotation.Annotation[] annotations, Errors errors) throws ErrorsException
ErrorsException
public static java.lang.annotation.Annotation findBindingAnnotation(Errors errors, java.lang.reflect.Member member, java.lang.annotation.Annotation[] annotations)
member
, or null if there isn't one.public static boolean isBindingAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
public static java.lang.annotation.Annotation canonicalizeIfNamed(java.lang.annotation.Annotation annotation)
javax.inject.Named
, canonicalizes to
com.google.guice.name.Named. Returns the given annotation otherwise.public static java.lang.Class<? extends java.lang.annotation.Annotation> canonicalizeIfNamed(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
javax.inject.Named
, canonicalizes to
com.google.guice.name.Named. Returns the given annotation class otherwise.