Introspection (Apache Tomcat 11.0.5 API Documentation)
Description: declaration: package: org.apache.catalina.util, class: Introspection

# Class Introspection

java.lang.Object
org.apache.catalina.util.Introspection

public class Introspection extends Object
Provides introspection utilities that either require knowledge of Tomcat internals or are solely used by Tomcat internals.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Introspection()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Class<?>`
  `convertPrimitiveType(Class<?> clazz)`
  Converts the primitive type to its corresponding wrapper.
  `static String`
  `getPropertyName(Method setter)`
  Extract the Java Bean property name from the setter name.
  `static boolean`
  `isValidLifecycleCallback(Method method)`
  Determines if a method is a valid lifecycle callback method.
  `static boolean`
  `isValidSetter(Method method)`
  Determines if a method has a valid name and signature for a Java Bean setter.
  `static Class<?>`
  `loadClass(Context context, String className)`
  Attempt to load a class using the given Container's class loader.

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

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

- ## Constructor Details

  - ### Introspection

    public Introspection()

- ## Method Details

  - ### getPropertyName

    public static String getPropertyName(Method setter)
    Extract the Java Bean property name from the setter name. Note: This method assumes that the method name has already been checked for correctness.
    Parameters:
      `setter` - The setter method
    Returns:
      the bean property name

  - ### isValidSetter

    public static boolean isValidSetter(Method method)
    Determines if a method has a valid name and signature for a Java Bean setter.
    Parameters:
      `method` - The method to test
    Returns:
      `true` if the method does have a valid name and signature, else `false`

  - ### isValidLifecycleCallback

    public static boolean isValidLifecycleCallback(Method method)
    Determines if a method is a valid lifecycle callback method.
    Parameters:
      `method` - The method to test
    Returns:
      `true` if the method is a valid lifecycle callback method, else `false`

  - ### loadClass

    public static Class<?> loadClass(Context context, String className)
    Attempt to load a class using the given Container's class loader. If the class cannot be loaded, a debug level log message will be written to the Container's log and null will be returned.
    Parameters:
      `context` - The class loader of this context will be used to attempt to load the class
      `className` - The class name
    Returns:
      the loaded class or `null` if loading failed

  - ### convertPrimitiveType

    public static Class<?> convertPrimitiveType(Class<?> clazz)
    Converts the primitive type to its corresponding wrapper.
    Parameters:
      `clazz` - Class that will be evaluated
    Returns:
      if the parameter is a primitive type returns its wrapper; otherwise returns the same class