org.licas.util

## Class ReflectionHandler

- java.lang.Object
- - org.licas.util.ReflectionHandler

-     public class ReflectionHandler
      extends java.lang.Object

  This class provides methods to process Objects using the Java `Reflection` package.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReflectionHandler()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.reflect.Constructor` | `getConstructor(java.lang.reflect.Constructor[] constructors, java.lang.Class[] paramTypes)` Check all constructors to see if any match the input parameters or super classes of the input parameters.
    `static java.lang.reflect.Constructor[]` | `getConstructors(java.lang.Class theClass)` Retrieve the constructors for the specified class.
    `static java.lang.reflect.Field` | `getInstanceField(java.lang.Object instanceObj, java.lang.String varName)` Get actual variable field instance if it is defined.
    `static java.lang.Object` | `getInstanceVariable(java.lang.Object instanceObj, java.lang.String varName)` Get the value of the named variable instance, if it is accessible.
    `static java.lang.reflect.Method[]` | `getMethods(java.lang.Class theClass)` Retrieve a list of all public methods in the class.
    `static boolean` | `hasConstructor(java.lang.String className, java.lang.Class[] paramTypes)` Return true if a constructor with the specified parameter list exists for the class type.
    `static java.lang.reflect.Method` | `retrieveMethod(java.lang.Class objClass, java.lang.String methodName)` Try to retrieve the method from the object, matching to the method name only.
    `static java.lang.reflect.Method` | `retrieveMethod(java.lang.Class objClass, java.lang.String methodName, java.lang.String replyClass)` Try to retrieve the method from the object.
    `static java.lang.reflect.Method` | `retrieveMethod(java.lang.Class objClass, java.lang.String methodName, java.lang.String replyClass, java.util.ArrayList<java.lang.String> paramTypes)` Try to retrieve the method from the object.

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

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

- - ### Constructor Detail

    - #### ReflectionHandler

          public ReflectionHandler()

  - ### Method Detail

    - #### getConstructors

          public static java.lang.reflect.Constructor[] getConstructors(java.lang.Class theClass)

      Retrieve the constructors for the specified class.
      Parameters:
        `theClass` - the class instance.
      Returns:
        a list of constructors.

    - #### getMethods

          public static java.lang.reflect.Method[] getMethods(java.lang.Class theClass)

      Retrieve a list of all public methods in the class.
      Parameters:
        `theClass` - the class instance.
      Returns:
        a list of all public methods.

    - #### getConstructor

          public static java.lang.reflect.Constructor getConstructor(java.lang.reflect.Constructor[] constructors,
                                                                     java.lang.Class[] paramTypes)

      Check all constructors to see if any match the input parameters or super classes of the input parameters.
      Parameters:
        `constructors` - a list of constructors.
        `paramTypes` - the parameter type classes.
      Returns:
        the constructor that matches the input parameters.

    - #### hasConstructor

          public static boolean hasConstructor(java.lang.String className,
                                               java.lang.Class[] paramTypes)

      Return true if a constructor with the specified parameter list exists for the class type.
      Parameters:
        `className` - the name of the java class to construct.
        `paramTypes` - a list of constructor parameter types.
      Returns:
        true if a constructor exists for the class type. False is also returned if the class cannot be constructed.

    - #### retrieveMethod

          public static java.lang.reflect.Method retrieveMethod(java.lang.Class objClass,
                                                                java.lang.String methodName)

      Try to retrieve the method from the object, matching to the method name only.
      Parameters:
        `objClass` - the class for the object that executes the method.
        `methodName` - the method name.
      Returns:
        the method that matches the spec or null if none exists.

    - #### retrieveMethod

          public static java.lang.reflect.Method retrieveMethod(java.lang.Class objClass,
                                                                java.lang.String methodName,
                                                                java.lang.String replyClass)

      Try to retrieve the method from the object.
      Parameters:
        `objClass` - the class for the object that executes the method.
        `methodName` - the method name.
        `replyClass` - the reply type. This is optional.
      Returns:
        the method that matches the spec or null if none exists.

    - #### retrieveMethod

          public static java.lang.reflect.Method retrieveMethod(java.lang.Class objClass,
                                                                java.lang.String methodName,
                                                                java.lang.String replyClass,
                                                                java.util.ArrayList<java.lang.String> paramTypes)

      Try to retrieve the method from the object.
      Parameters:
        `objClass` - the class for the object that executes the method.
        `methodName` - the method name.
        `replyClass` - the reply type. This is optional.
        `paramTypes` - list of parameter types. Can be empty.
      Returns:
        the method that matches the spec or null if none exists.

    - #### getInstanceField

          public static java.lang.reflect.Field getInstanceField(java.lang.Object instanceObj,
                                                                 java.lang.String varName)

      Get actual variable field instance if it is defined.
      Parameters:
        `instanceObj` - the object instance to set the value on.
        `varName` - the name of the variable to set it's value.
      Returns:
        the reflection field to set the value on, or null if it is missing.

    - #### getInstanceVariable

          public static java.lang.Object getInstanceVariable(java.lang.Object instanceObj,
                                                             java.lang.String varName)

      Get the value of the named variable instance, if it is accessible.
      Parameters:
        `instanceObj` - the object instance to set the value on.
        `varName` - the name of the variable to set it's value.
      Returns:
        the value of the variable (the variable itself) if it can be accessed.