Class ReflectionUtil

  • public class ReflectionUtil
    extends java.lang.Object
    Utilities for Managing Serialization and Reflection
    Jacob Hookom []
    • Field Summary

      Modifier and Type Field Description
      protected static java.lang.String[] PRIMITIVE_NAMES  
      protected static java.lang.Class<?>[] PRIMITIVES  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class<?> forName​(java.lang.String name)  
      protected static java.lang.Class<?> forNamePrimitive​(java.lang.String name)  
      static java.lang.reflect.Method getMethod​(EvaluationContext ctx, java.lang.Object base, java.lang.Object property, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues)
      Returns a method based on the criteria.
      static java.lang.Class<?>[] toTypeArray​(java.lang.String[] s)
      Converts an array of Class names to Class types.
      static java.lang.String[] toTypeNameArray​(java.lang.Class<?>[] c)
      Converts an array of Class types to Class names.
      • Methods inherited from class java.lang.Object

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


        protected static final java.lang.String[] PRIMITIVE_NAMES

        protected static final java.lang.Class<?>[] PRIMITIVES
    • Method Detail

      • forName

        public static java.lang.Class<?> forName​(java.lang.String name)
                                          throws java.lang.ClassNotFoundException
      • forNamePrimitive

        protected static java.lang.Class<?> forNamePrimitive​(java.lang.String name)
      • toTypeArray

        public static java.lang.Class<?>[] toTypeArray​(java.lang.String[] s)
                                                throws java.lang.ClassNotFoundException
        Converts an array of Class names to Class types.
        s - The array of class names
        An array of Class instance where the element at index i in the result is an instance of the class with the name at index i in the input
        java.lang.ClassNotFoundException - If a class of a given name cannot be found
      • toTypeNameArray

        public static java.lang.String[] toTypeNameArray​(java.lang.Class<?>[] c)
        Converts an array of Class types to Class names.
        c - The array of class instances
        An array of Class names where the element at index i in the result is the name of the class instance at index i in the input
      • getMethod

        public static java.lang.reflect.Method getMethod​(EvaluationContext ctx,
                                                         java.lang.Object base,
                                                         java.lang.Object property,
                                                         java.lang.Class<?>[] paramTypes,
                                                         java.lang.Object[] paramValues)
                                                  throws MethodNotFoundException
        Returns a method based on the criteria.
        ctx - the context in which the expression is being evaluated
        base - the object that owns the method
        property - the name of the method
        paramTypes - the parameter types to use
        paramValues - the parameter values
        the method specified
        MethodNotFoundException - If a method cannot be found that matches the given criteria