Package org.apache.juneau.reflect
Class AnnotationInfo<T extends Annotation>
java.lang.Object
org.apache.juneau.reflect.AnnotationInfo<T>
- Type Parameters:
- T- The annotation type.
Represents an annotation instance on a class and the class it was found on.
 
See Also:
- 
Method SummaryModifier and TypeMethodDescriptionaccept(Predicate<AnnotationInfo<?>> test, Consumer<AnnotationInfo<?>> action) Performs an action on this object if the specified predicate test passes.<V> AnnotationInfo<?>forEachValue(Class<V> type, String name, Predicate<V> test, Consumer<V> action) Performs an action on all matching values on this annotation.getApplies(VarResolverSession vrs, Consumer<AnnotationApplier<Annotation, Object>> consumer) If this annotation has aContextApplyannotation, consumes an instance of the specifiedAnnotationApplierclass.Returns the class that this annotation was found on.Returns the class where the annotation was found.Returns the method where the annotation was found.getName()Returns the class name of the annotation.Returns the package where the annotation was found.<V> Optional<V>Returns a matching value on this annotation.<A extends Annotation>
 booleanhasAnnotation(Class<A> type) Returnstrue if this annotation has the specified annotation defined on it.inner()Returns the annotation found.<A extends Annotation>
 booleanReturnstrue if this annotation is in the specifiedgroup.<A extends Annotation>
 booleanReturnstrue if this annotation is the specified type.booleanmatches(Predicate<AnnotationInfo<?>> test) Returnstrue if this object passes the specified predicate test.static <A extends Annotation>
 AnnotationInfo<A>Convenience constructor when annotation is found on a package.static <A extends Annotation>
 AnnotationInfo<A>Convenience constructor when annotation is found on a class.static <A extends Annotation>
 AnnotationInfo<A>of(MethodInfo onMethod, A value) Convenience constructor when annotation is found on a method.Converts this object to a readable JSON object for debugging purposes.toString()
- 
Method Details- 
ofConvenience constructor when annotation is found on a class.- Type Parameters:
- A- The annotation class.
- Parameters:
- onClass- The class where the annotation was found.
- value- The annotation found.
- Returns:
- A new AnnotationInfoobject.
 
- 
ofConvenience constructor when annotation is found on a method.- Type Parameters:
- A- The annotation class.
- Parameters:
- onMethod- The method where the annotation was found.
- value- The annotation found.
- Returns:
- A new AnnotationInfoobject.
 
- 
ofConvenience constructor when annotation is found on a package.- Type Parameters:
- A- The annotation class.
- Parameters:
- onPackage- The package where the annotation was found.
- value- The annotation found.
- Returns:
- A new AnnotationInfoobject.
 
- 
getClassOnReturns the class where the annotation was found.- Returns:
- the class where the annotation was found, or null if it wasn't found on a method.
 
- 
getMethodOnReturns the method where the annotation was found.- Returns:
- the method where the annotation was found, or null if it wasn't found on a method.
 
- 
getPackageOnReturns the package where the annotation was found.- Returns:
- the package where the annotation was found, or null if it wasn't found on a package.
 
- 
innerReturns the annotation found.- Returns:
- The annotation found.
 
- 
getNameReturns the class name of the annotation.- Returns:
- The simple class name of the annotation.
 
- 
toJsonMapConverts this object to a readable JSON object for debugging purposes.- Returns:
- A new map showing the attributes of this object as a JSON object.
 
- 
getAppliespublic AnnotationInfo<T> getApplies(VarResolverSession vrs, Consumer<AnnotationApplier<Annotation, Object>> consumer) throws ExecutableExceptionIf this annotation has aContextApplyannotation, consumes an instance of the specifiedAnnotationApplierclass.- Parameters:
- vrs- Variable resolver passed to the- AnnotationApplierobject.
- consumer- The consumer.
- Returns:
- This object.
- Throws:
- ExecutableException- Exception occurred on invoked constructor/method/field.
 
- 
getClassInfoReturns the class that this annotation was found on.- Returns:
- The class that this annotation was found on, or null if it was found on a package.
 
- 
isTypeReturnstrue if this annotation is the specified type.- Type Parameters:
- A- The annotation class.
- Parameters:
- type- The type to test against.
- Returns:
- true if this annotation is the specified type.
 
- 
hasAnnotationReturnstrue if this annotation has the specified annotation defined on it.- Type Parameters:
- A- The annotation class.
- Parameters:
- type- The annotation to test for.
- Returns:
- true if this annotation has the specified annotation defined on it.
 
- 
isInGroupReturnstrue if this annotation is in the specifiedgroup.- Type Parameters:
- A- The annotation class.
- Parameters:
- group- The group annotation.
- Returns:
- true if this annotation is in the specified- group.
 
- 
matchesReturnstrue if this object passes the specified predicate test.- Parameters:
- test- The test to perform.
- Returns:
- true if this object passes the specified predicate test.
 
- 
acceptpublic AnnotationInfo<?> accept(Predicate<AnnotationInfo<?>> test, Consumer<AnnotationInfo<?>> action) Performs an action on this object if the specified predicate test passes.- Parameters:
- test- A test to apply to determine if action should be executed. Can be- null .
- action- An action to perform on this object.
- Returns:
- This object.
 
- 
toString
- 
forEachValuepublic <V> AnnotationInfo<?> forEachValue(Class<V> type, String name, Predicate<V> test, Consumer<V> action) Performs an action on all matching values on this annotation.- Type Parameters:
- V- The annotation field type.
- Parameters:
- type- The annotation field type.
- name- The annotation field name.
- test- A predicate to apply to the value to determine if action should be performed. Can be- null .
- action- An action to perform on the value.
- Returns:
- This object.
 
- 
getValueReturns a matching value on this annotation.- Type Parameters:
- V- The annotation field type.
- Parameters:
- type- The annotation field type.
- name- The annotation field name.
- test- A predicate to apply to the value to determine if value should be used. Can be- null .
- Returns:
- This object.
 
 
-