IntrospectionUtils (Apache Tomcat 7.0.104 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.AttributeHolder` Deprecated. Is used only by deprecated method
    `static interface` | `IntrospectionUtils.PropertySource`
    `static interface` | `IntrospectionUtils.SecurePropertySource`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PATH_SEPARATOR` Deprecated. Used only by deprecated method

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntrospectionUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addJarsFromClassPath(Vector<URL> jars, String cp)` Deprecated. Is used only by deprecated method
    `static void` | `addToClassPath(Vector<URL> cpV, String dir)` Deprecated. Is used only by deprecated method
    `static void` | `addToolsJar(Vector<URL> v)` Deprecated. Is used only by deprecated method
    `static void` | `callMain(Class<?> c, String[] args)` Deprecated. Not used
    `static Object` | `callMethod0(Object target, String methodN)` Deprecated. Not used, though compliments callMethod1 and callMethodN here
    `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 String` | `classPathAdd(URL[] urls, String cp)` Deprecated. Not used
    `static void` | `clear()`
    `static Object` | `convert(String object, Class<?> paramType)`
    `static void` | `displayClassPath(String msg, URL[] cp)` Deprecated. Not used
    `static void` | `execute(Object proxy, String method)` Deprecated. Not used
    `static Method` | `findMethod(Class<?> c, String name, Class<?>[] params)`
    `static Method[]` | `findMethods(Class<?> c)`
    `static Object` | `getAttribute(Object proxy, String n)` Deprecated. Not used
    `static URL[]` | `getClassPath(String dir, String cpath, String cpathProp, boolean addTools)` Deprecated. Not used
    `static URL[]` | `getClassPath(Vector<URL> v)` Deprecated. Is used only by deprecated method
    `static String[]` | `getFilesByExt(String ld, String ext)` Deprecated. Is used only by deprecated method
    `static Object` | `getProperty(Object o, String name)`
    `static URL` | `getURL(String base, String file)` Deprecated. Is used only by deprecated method
    `static ClassLoader` | `getURLClassLoader(URL[] urls, ClassLoader parent)` Deprecated. Not used
    `static String` | `guessInstall(String installSysProp, String homeSysProp, String jarName)` Deprecated. No longer required. Will be removed in Tomcat 8.0.x.
    `static String` | `guessInstall(String installSysProp, String homeSysProp, String jarName, String classFile)` Deprecated. No longer required. Will be removed in Tomcat 8.0.x.
    `static boolean` | `hasHook(Object obj, String methodN)` Deprecated. Not used
    `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)` Replaces ${NAME} in the value with the value of the property 'NAME'.
    `static void` | `setAttribute(Object proxy, String n, Object v)` Deprecated. Not used
    `static void` | `setProperty(Object o, String name)` Deprecated. Not used
    `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)`
    `static String` | `unCapitalize(String name)` Deprecated. Not used

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

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

- - ### Field Detail

    - #### PATH_SEPARATOR

          @Deprecated
          public static final String PATH_SEPARATOR

      Deprecated. Used only by deprecated method

  - ### Constructor Detail

    - #### IntrospectionUtils

          public IntrospectionUtils()

  - ### Method Detail

    - #### execute

          @Deprecated
          public static void execute(Object proxy,
                                String method)
                              throws Exception

      Deprecated. Not used
      Call execute() - any ant-like task should work
      Throws:
        `Exception`

    - #### setAttribute

          @Deprecated
          public static void setAttribute(Object proxy,
                                     String n,
                                     Object v)
                                   throws Exception

      Deprecated. Not used
      Call void setAttribute( String ,Object )
      Throws:
        `Exception`

    - #### getAttribute

          @Deprecated
          public static Object getAttribute(Object proxy,
                                       String n)
                                     throws Exception

      Deprecated. Not used
      Call void getAttribute( String )
      Throws:
        `Exception`

    - #### getURLClassLoader

          @Deprecated
          public static ClassLoader getURLClassLoader(URL[] urls,
                                                 ClassLoader parent)

      Deprecated. Not used
      Construct a URLClassLoader. Will compile and work in JDK1.1 too.

    - #### guessInstall

          @Deprecated
          public static String guessInstall(String installSysProp,
                                       String homeSysProp,
                                       String jarName)

      Deprecated. No longer required. Will be removed in Tomcat 8.0.x.

    - #### guessInstall

          @Deprecated
          public static String guessInstall(String installSysProp,
                                       String homeSysProp,
                                       String jarName,
                                       String classFile)

      Deprecated. No longer required. Will be removed in Tomcat 8.0.x.
      Guess a product install/home by analyzing the class path. It works for product using the pattern: lib/executable.jar or if executable.jar is included in classpath by a shell script. ( java -jar also works ) Insures both "install" and "home" System properties are set. If either or both System properties are unset, "install" and "home" will be set to the same value. This value will be the other System property that is set, or the guessed value if neither is set.

    - #### displayClassPath

          @Deprecated
          public static void displayClassPath(String msg,
                                         URL[] cp)

      Deprecated. Not used
      Debug method, display the classpath

    - #### classPathAdd

          @Deprecated
          public static String classPathAdd(URL[] urls,
                                       String cp)

      Deprecated. Not used
      Adds classpath entries from a vector of URL's to the "tc_path_add" System property. This System property lists the classpath entries common to web applications. This System property is currently used by Jasper when its JSP servlet compiles the Java file for a JSP.

    - #### 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)

    - #### setProperty

          @Deprecated
          public static void setProperty(Object o,
                                    String name)

      Deprecated. Not used

    - #### replaceProperties

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

      Deprecated. Use `replaceProperties(String, Hashtable, PropertySource[], ClassLoader)`
      Replaces ${NAME} in the value with the value of the property 'NAME'. Replaces ${NAME:DEFAULT} with the value of the property 'NAME:DEFAULT', if the property 'NAME:DEFAULT' is not set, the expression is replaced with the value of the property 'NAME', if the property 'NAME' is not set, the expression is replaced with 'DEFAULT'. If the property is not set and there is no default the value will be returned unmodified.
      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)

      Replaces ${NAME} in the value with the value of the property 'NAME'. Replaces ${NAME:DEFAULT} with the value of the property 'NAME:DEFAULT', if the property 'NAME:DEFAULT' is not set, the expression is replaced with the value of the property 'NAME', if the property 'NAME' is not set, the expression is replaced with 'DEFAULT'. If the property is not set and there is no default the value will be returned unmodified.
      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

    - #### unCapitalize

          @Deprecated
          public static String unCapitalize(String name)

      Deprecated. Not used

    - #### addToClassPath

          @Deprecated
          public static void addToClassPath(Vector<URL> cpV,
                                       String dir)

      Deprecated. Is used only by deprecated method
      Add all the jar files in a dir to the classpath, represented as a Vector of URLs.

    - #### addToolsJar

          @Deprecated
          public static void addToolsJar(Vector<URL> v)

      Deprecated. Is used only by deprecated method

    - #### getFilesByExt

          @Deprecated
          public static String[] getFilesByExt(String ld,
                                          String ext)

      Deprecated. Is used only by deprecated method
      Return all files with a given extension in a dir

    - #### getURL

          @Deprecated
          public static URL getURL(String base,
                              String file)

      Deprecated. Is used only by deprecated method
      Construct a file url from a file, using a base dir

    - #### addJarsFromClassPath

          @Deprecated
          public static void addJarsFromClassPath(Vector<URL> jars,
                                             String cp)
                                           throws IOException,
                                                  MalformedURLException

      Deprecated. Is used only by deprecated method
      Add elements from the classpath cp to a Vector jars as file URLs (We use Vector for JDK 1.1 compat).

      Parameters:
        `jars` - The jar list
        `cp` - a String classpath of directory or jar file elements separated by path.separator delimiters.
      Throws:
        `IOException` - If an I/O error occurs
        `MalformedURLException` - Doh ;)

    - #### getClassPath

          @Deprecated
          public static URL[] getClassPath(Vector<URL> v)

      Deprecated. Is used only by deprecated method
      Return a URL[] that can be used to construct a class loader

    - #### getClassPath

          @Deprecated
          public static URL[] getClassPath(String dir,
                                      String cpath,
                                      String cpathProp,
                                      boolean addTools)
                                    throws IOException,
                                           MalformedURLException

      Deprecated. Not used
      Construct a URL classpath from files in a directory, a cpath property, and tools.jar.
      Throws:
        `IOException`
        `MalformedURLException`

    - #### clear

          public static void clear()

    - #### findMethods

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

    - #### findMethod

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

    - #### hasHook

          @Deprecated
          public static boolean hasHook(Object obj,
                                   String methodN)

      Deprecated. Not used
      Test if the object implements a particular method

    - #### callMain

          @Deprecated
          public static void callMain(Class<?> c,
                                 String[] args)
                               throws Exception

      Deprecated. Not used
      Throws:
        `Exception`

    - #### callMethod1

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

      Throws:
        `Exception`

    - #### callMethod0

          @Deprecated
          public static Object callMethod0(Object target,
                                      String methodN)
                                    throws Exception

      Deprecated. Not used, though compliments callMethod1 and callMethodN here
      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.