org.apache.struts2.convention

## Class ReflectionTools

- java.lang.Object
- - org.apache.struts2.convention.ReflectionTools

-     public class ReflectionTools
      extends Object

  This class has some reflection helpers.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReflectionTools()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsMethod(Class<?> clazz, String method, Class<?>... parameterTypes)` Determines if the class given contains the method.
    `static <T extends Annotation> T` | `getAnnotation(Class<?> clazz, String methodName, Class<T> annotationClass)` Retrieves the annotation from the given method in the given class.
    `static List<Class<?>>` | `getClassHierarchy(Class<?> clazz)` Return the list of parent classes in order (Object will be at index 0)

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReflectionTools

          public ReflectionTools()

  - ### Method Detail

    - #### containsMethod

          public static boolean containsMethod(Class<?> clazz,
                               String method,
                               Class<?>... parameterTypes)

      Determines if the class given contains the method.
      Parameters:
        `clazz` - The class to check for the method.
        `method` - The method name.
        `parameterTypes` - The parameter types of the method.
      Returns:
        True if the method exists, false if not.

    - #### getAnnotation

          public static <T extends Annotation> T getAnnotation(Class<?> clazz,
                                               String methodName,
                                               Class<T> annotationClass)

      Retrieves the annotation from the given method in the given class.
      Type Parameters:
        `T` - type of annotated class
      Parameters:
        `clazz` - The class.
        `methodName` - The method.
        `annotationClass` - The annotation to get.
      Returns:
        The annotation or null if it doesn't exist.

    - #### getClassHierarchy

          public static List<Class<?>> getClassHierarchy(Class<?> clazz)

      Return the list of parent classes in order (Object will be at index 0)
      Parameters:
        `clazz` - class to process
      Returns:
        hierarchy of classes

Copyright © 2000–2021 Apache Software Foundation. All rights reserved.