Class ReflectionHelper

java.lang.Object
org.jboss.arquillian.graphene.enricher.ReflectionHelper

public final class ReflectionHelper extends Object
SecurityActions A set of privileged actions that are not to leak out of this package
Version:
$Revision: $
Author:
ALR
  • Method Details

    • getThreadContextClassLoader

      public static ClassLoader getThreadContextClassLoader()
      Obtains the Thread Context ClassLoader
    • getConstructor

      public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... argumentTypes) throws NoSuchMethodException
      Obtains the Constructor specified from the given Class and argument types
      Parameters:
      clazz -
      argumentTypes -
      Returns:
      Throws:
      NoSuchMethodException
    • getAssignableConstructor

      public static <T> Constructor<T> getAssignableConstructor(Class<T> clazz, Class<?>... argumentTypes) throws NoSuchMethodException
      Throws:
      NoSuchMethodException
    • hasConstructor

      public static boolean hasConstructor(Class<?> clazz, Class<?>... argumentTypes)
    • newInstance

      public static <T> T newInstance(String className, Class<?>[] argumentTypes, Object[] arguments, Class<T> expectedType)
      Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for instantiation.
      Parameters:
      className - Full classname of class to create
      argumentTypes - The constructor argument types
      arguments - The constructor arguments
      Returns:
      a new instance
      Throws:
      IllegalArgumentException - if className, argumentTypes, or arguments are null
      RuntimeException - if any exceptions during creation
    • isClassPresent

      public static boolean isClassPresent(String name)
    • getFields

      public static List<Field> getFields(Class<?> source)
    • getFieldsWithAnnotation

      public static List<Field> getFieldsWithAnnotation(Class<?> source, Class<? extends Annotation> annotationClass)
    • getFieldsWithAnnotatedAnnotation

      public static List<Field> getFieldsWithAnnotatedAnnotation(Class<?> source, Class<? extends Annotation> annotationClass)
    • getMethodsWithAnnotation

      public static List<Method> getMethodsWithAnnotation(Class<?> source, Class<? extends Annotation> annotationClass)
    • getParametersWithAnnotation

      public static List<Object[]> getParametersWithAnnotation(Method method, Class<? extends Annotation> annotationClass)
      Returns all couples of found parameter annotated with the given annotation and an array of all annotations the parameter is annotated with for the given method
      Parameters:
      method - - the method where the parameters should be examined
      annotationClass - - the annotation the parameters should be annotated with
      Returns:
      list of couples in an object array that consist of found parameter annotated with the given annotation and an array of all annotations the parameter is annotated with
    • findAnnotation

      public static <T extends Annotation> T findAnnotation(Annotation[] annotations, Class<T> needle)
      Finds some annotation in the given array of annotations
      Parameters:
      annotations - - array of annotations
      needle - - annotation we are looking for
      Returns:
      the found annotation
    • getQualifier

      public static Class<?> getQualifier(Annotation[] annotations)