ConstructorUtil (Apache Tomcat 7.0.108 API Documentation)

org.apache.tomcat.dbcp.jocl

## Class ConstructorUtil

- java.lang.Object
- - org.apache.tomcat.dbcp.jocl.ConstructorUtil

-     public class ConstructorUtil
      extends Object

  Miscellaneous `Constructor` related utility functions.
  Author:
    Rodney Waldhoff

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConstructorUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> Constructor<T>` | `getConstructor(Class<T> type, Class<?>[] argTypes)` Returns a `Constructor` for the given method signature, or `null` if no such `Constructor` can be found.
    `static <T> T` | `invokeConstructor(Class<T> type, Class<?>[] argTypes, Object[] argValues)` Creates a new instance of the specified `type` using a `Constructor` described by the given parameter types and values.

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

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

- - ### Constructor Detail

    - #### ConstructorUtil

          public ConstructorUtil()

  - ### Method Detail

    - #### getConstructor

          public static <T> Constructor<T> getConstructor(Class<T> type,
                                          Class<?>[] argTypes)

      Returns a `Constructor` for the given method signature, or `null` if no such `Constructor` can be found.
      Parameters:
        `type` - the (non-`null`) type of `Object` the returned `Constructor` should create
        `argTypes` - a non-`null` array of types describing the parameters to the `Constructor`.
      Returns:
        a `Constructor` for the given method signature, or `null` if no such `Constructor` can be found.
      See Also:
        `invokeConstructor(java.lang.Class<T>, java.lang.Class<?>[], java.lang.Object[])`

    - #### invokeConstructor

          public static <T> T invokeConstructor(Class<T> type,
                                Class<?>[] argTypes,
                                Object[] argValues)
                                     throws InstantiationException,
                                            IllegalAccessException,
                                            InvocationTargetException

      Creates a new instance of the specified `type` using a `Constructor` described by the given parameter types and values.
      Parameters:
        `type` - the type of `Object` to be created
        `argTypes` - a non-`null` array of types describing the parameters to the `Constructor`.
        `argValues` - a non-`null` array containing the values of the parameters to the `Constructor`.
      Returns:
        a new instance of the specified `type` using a `Constructor` described by the given parameter types and values.
      Throws:
        `InstantiationException`
        `IllegalAccessException`
        `InvocationTargetException`

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