Package org.hcjf.utils
Class Introspection.Invoker
- java.lang.Object
-
- org.hcjf.utils.Introspection.Invoker
-
- Direct Known Subclasses:
Introspection.Accessor
- Enclosing class:
- Introspection
public abstract static class Introspection.Invoker extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Invoker(java.lang.Class implementationClass, java.lang.reflect.Method method)
-
Method Summary
Modifier and Type Method Description <A extends java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<? extends A> annotationClass)Returns the instance of the annotation class associated to the accessor method, or null if the annotation doesn't exist.<A extends java.lang.annotation.Annotation>
java.util.List<A>getAnnotations(java.lang.Class<? extends A> annotationClass)Returns the list of the annotation instances associated to the invoker, or null if the annotation class is not present into the invoker.java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.List<java.lang.annotation.Annotation>>getAnnotationsMap()Return an unmodifiable map with all the annotation instances associated to the method indexed by the class of the each annotation instance.java.lang.ClassgetImplementationClass()Return the the name of the class when the method is implemented.java.lang.reflect.MethodgetMethod()Return the name of the accessor method.java.lang.Objectinvoke(java.lang.Object instance, java.lang.Object... params)Wrapper method to get the storage method.booleanisAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Verify if exists an instance of the annotation class associated to the accessor method.
-
-
-
Method Detail
-
getImplementationClass
public final java.lang.Class getImplementationClass()
Return the the name of the class when the method is implemented.- Returns:
- Implementation class name.
-
getMethod
public final java.lang.reflect.Method getMethod()
Return the name of the accessor method.- Returns:
- Name of the accessor method.
-
isAnnotationPresent
public final boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Verify if exists an instance of the annotation class associated to the accessor method.- Parameters:
annotationClass- Annotation class.- Returns:
- True if the instance exists and false in the otherwise.
-
getAnnotation
public final <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<? extends A> annotationClass)
Returns the instance of the annotation class associated to the accessor method, or null if the annotation doesn't exist. This method return the first instance of the list of annotations.- Type Parameters:
A- Expected annotation type.- Parameters:
annotationClass- Annotation class.- Returns:
- Annotation instance or null.
-
getAnnotations
public final <A extends java.lang.annotation.Annotation> java.util.List<A> getAnnotations(java.lang.Class<? extends A> annotationClass)
Returns the list of the annotation instances associated to the invoker, or null if the annotation class is not present into the invoker.- Type Parameters:
A- Expected annotation type.- Parameters:
annotationClass- Annotation class.- Returns:
- Unmodifiable list of annotation instances.
-
getAnnotationsMap
public final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.List<java.lang.annotation.Annotation>> getAnnotationsMap()
Return an unmodifiable map with all the annotation instances associated to the method indexed by the class of the each annotation instance.- Returns:
- Unmodifiable map.
-
invoke
public java.lang.Object invoke(java.lang.Object instance, java.lang.Object... params)Wrapper method to get the storage method.- Parameters:
instance- Instance to get the method.params- Method parameters.- Returns:
- Invocation result.
- Throws:
java.lang.reflect.InvocationTargetException- Invocation Target Exceptionjava.lang.IllegalAccessException- Illegal Access Exception
-
-