IntrospectionUtils (Apache Tomcat 8.5.53 API Documentation)

org.apache.tomcat.util

## Class IntrospectionUtils

- java.lang.Object
- - org.apache.tomcat.util.IntrospectionUtils

-     public final class IntrospectionUtils
      extends Object

  Utils for introspection and reflection

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `IntrospectionUtils.PropertySource`
    `static interface` | `IntrospectionUtils.SecurePropertySource`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntrospectionUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Object` | `callMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl)`
    `static Object` | `callMethodN(Object target, String methodN, Object[] params, Class<?>[] typeParams)`
    `static String` | `capitalize(String name)` Reverse of Introspector.decapitalize.
    `static void` | `clear()`
    `static Object` | `convert(String object, Class<?> paramType)`
    `static Method` | `findMethod(Class<?> c, String name, Class<?>[] params)`
    `static Method[]` | `findMethods(Class<?> c)`
    `static Object` | `getProperty(Object o, String name)`
    `static boolean` | `isInstance(Class<?> clazz, String type)` Checks to see if the specified class is an instance of or assignable from the specified type.
    `static String` | `replaceProperties(String value, Hashtable<Object,Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp)` Deprecated. Use `replaceProperties(String, Hashtable, PropertySource[], ClassLoader)`
    `static String` | `replaceProperties(String value, Hashtable<Object,Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp, ClassLoader classLoader)` Replace ${NAME} with the property value.
    `static boolean` | `setProperty(Object o, String name, 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(Object o, String name, 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(Object o,
                            String name,
                            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(Object o,
                            String name,
                            String value,
                            boolean invokeSetProperty)

    - #### getProperty

          public static Object getProperty(Object o,
                           String name)

    - #### replaceProperties

          @Deprecated
          public static String replaceProperties(String value,
                                            Hashtable<Object,Object> staticProp,
                                            IntrospectionUtils.PropertySource[] dynamicProp)

      Deprecated. Use `replaceProperties(String, Hashtable, PropertySource[], ClassLoader)`
      Replace ${NAME} with the property value.
      Parameters:
        `value` - The value
        `staticProp` - Replacement properties
        `dynamicProp` - Replacement properties
      Returns:
        the replacement value

    - #### replaceProperties

          public static String replaceProperties(String value,
                                 Hashtable<Object,Object> staticProp,
                                 IntrospectionUtils.PropertySource[] dynamicProp,
                                 ClassLoader classLoader)

      Replace ${NAME} with the property value.
      Parameters:
        `value` - The value
        `staticProp` - Replacement properties
        `dynamicProp` - Replacement properties
        `classLoader` - Class loader associated with the code requesting the property
      Returns:
        the replacement value

    - #### capitalize

          public static String capitalize(String name)

      Reverse of Introspector.decapitalize.
      Parameters:
        `name` - The name
      Returns:
        the capitalized string

    - #### clear

          public static void clear()

    - #### findMethods

          public static Method[] findMethods(Class<?> c)

    - #### findMethod

          public static Method findMethod(Class<?> c,
                          String name,
                          Class<?>[] params)

    - #### callMethod1

          public static Object callMethod1(Object target,
                           String methodN,
                           Object param1,
                           String typeParam1,
                           ClassLoader cl)
                                    throws Exception

      Throws:
        `Exception`

    - #### callMethodN

          public static Object callMethodN(Object target,
                           String methodN,
                           Object[] params,
                           Class<?>[] typeParams)
                                    throws Exception

      Throws:
        `Exception`

    - #### convert

          public static Object convert(String object,
                       Class<?> paramType)

    - #### isInstance

          public static boolean isInstance(Class<?> clazz,
                           String type)

      Checks to see if the specified class is an instance of or assignable from the specified type. The class `clazz`, all its superclasses, interfaces and those superinterfaces are tested for a match against the type name `type`. This is similar to `instanceof` or `Class.isAssignableFrom(java.lang.Class<?>)` except that the target type will not be resolved into a Class object, which provides some security and memory benefits.
      Parameters:
        `clazz` - The class to test for a match.
        `type` - The name of the type that `clazz` must be.
      Returns:
        `true` if the `clazz` tested is an instance of the specified `type`, `false` otherwise.

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.