Class ReflectionHelper


  • @InternalApi
    public final class ReflectionHelper
    extends java.lang.Object
    Class containing static helper methods for reflective access.
    Since:
    2.2
    Author:
    Mark Rotteveel
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.reflect.Field findField​(java.lang.Class<?> clazz, java.lang.String name)
      Helper function to find a declared field in a class.
      static java.lang.reflect.Method findMethod​(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] args)
      Helper function to find a method in a class.
      static java.lang.Class<?>[] getAllInterfaces​(java.lang.Class<?> clazz)
      Get all implemented interfaces by the class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getAllInterfaces

        public static java.lang.Class<?>[] getAllInterfaces​(java.lang.Class<?> clazz)
        Get all implemented interfaces by the class.
        Parameters:
        clazz - class to inspect
        Returns:
        array of all implemented interfaces
      • findMethod

        public static java.lang.reflect.Method findMethod​(java.lang.Class<?> clazz,
                                                          java.lang.String name,
                                                          java.lang.Class<?>[] args)
        Helper function to find a method in a class.
        Parameters:
        clazz - class in which to look for the method
        name - name of the method
        args - types of method params
        Returns:
        instance of Method corresponding to name and args
      • findField

        public static java.lang.reflect.Field findField​(java.lang.Class<?> clazz,
                                                        java.lang.String name)
        Helper function to find a declared field in a class.
        Parameters:
        clazz - class in which to look for the field
        name - name of the field
        Returns:
        instance of Field corresponding to name
        Throws:
        java.lang.IllegalArgumentException - if no field was found
        Since:
        5.0.13