Class IntrospectionUtils


  • public final class IntrospectionUtils
    extends java.lang.Object
    Utils for introspection and reflection
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object callMethod1​(java.lang.Object target, java.lang.String methodN, java.lang.Object param1, java.lang.String typeParam1, java.lang.ClassLoader cl)  
      static java.lang.Object callMethodN​(java.lang.Object target, java.lang.String methodN, java.lang.Object[] params, java.lang.Class<?>[] typeParams)  
      static java.lang.String capitalize​(java.lang.String name)
      Reverse of Introspector.decapitalize.
      static void clear()  
      static java.lang.Object convert​(java.lang.String object, java.lang.Class<?> paramType)  
      static java.lang.reflect.Method findMethod​(java.lang.Class<?> c, java.lang.String name, java.lang.Class<?>[] params)  
      static java.lang.reflect.Method[] findMethods​(java.lang.Class<?> c)  
      static java.lang.Object getProperty​(java.lang.Object o, java.lang.String name)  
      static java.lang.String replaceProperties​(java.lang.String value, java.util.Hashtable<java.lang.Object,​java.lang.Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp)
      Replace ${NAME} with the property value.
      static boolean setProperty​(java.lang.Object o, java.lang.String name, java.lang.String value)
      Find a method with the right name If found, call the method ( if param is int or boolean we'll convert value to the right type before) - that means you can have setDebug(1).
      static boolean setProperty​(java.lang.Object o, java.lang.String name, java.lang.String value, boolean invokeSetProperty)  
      • Methods inherited from class java.lang.Object

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

      • IntrospectionUtils

        public IntrospectionUtils()
    • Method Detail

      • setProperty

        public static boolean setProperty​(java.lang.Object o,
                                          java.lang.String name,
                                          java.lang.String value)
        Find a method with the right name If found, call the method ( if param is int or boolean we'll convert value to the right type before) - that means you can have setDebug(1).
        Parameters:
        o - The object to set a property on
        name - The property name
        value - The property value
        Returns:
        true if operation was successful
      • setProperty

        public static boolean setProperty​(java.lang.Object o,
                                          java.lang.String name,
                                          java.lang.String value,
                                          boolean invokeSetProperty)
      • getProperty

        public static java.lang.Object getProperty​(java.lang.Object o,
                                                   java.lang.String name)
      • replaceProperties

        public static java.lang.String replaceProperties​(java.lang.String value,
                                                         java.util.Hashtable<java.lang.Object,​java.lang.Object> staticProp,
                                                         IntrospectionUtils.PropertySource[] dynamicProp)
        Replace ${NAME} with the property value.
        Parameters:
        value - The value
        staticProp - Replacement properties
        dynamicProp - Replacement properties
        Returns:
        the replacement value
      • capitalize

        public static java.lang.String capitalize​(java.lang.String name)
        Reverse of Introspector.decapitalize.
        Parameters:
        name - The name
        Returns:
        the capitalized string
      • clear

        public static void clear()
      • findMethods

        public static java.lang.reflect.Method[] findMethods​(java.lang.Class<?> c)
      • findMethod

        public static java.lang.reflect.Method findMethod​(java.lang.Class<?> c,
                                                          java.lang.String name,
                                                          java.lang.Class<?>[] params)
      • callMethod1

        public static java.lang.Object callMethod1​(java.lang.Object target,
                                                   java.lang.String methodN,
                                                   java.lang.Object param1,
                                                   java.lang.String typeParam1,
                                                   java.lang.ClassLoader cl)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • callMethodN

        public static java.lang.Object callMethodN​(java.lang.Object target,
                                                   java.lang.String methodN,
                                                   java.lang.Object[] params,
                                                   java.lang.Class<?>[] typeParams)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • convert

        public static java.lang.Object convert​(java.lang.String object,
                                               java.lang.Class<?> paramType)