Class ParameterTypes

java.lang.Object
org.fest.reflect.constructor.ParameterTypes

public final class ParameterTypes extends Object
Understands the parameter types for the constructor to invoke.

The following is an example of proper usage of the classes in this package:

   // Equivalent to call 'new Person()'
   Person p = constructor().in(Person.class).newInstance();

   // Equivalent to call 'new Person("Yoda")'
   Person p = constructor().withParameterTypes(String.class).in(Person.class).newInstance("Yoda");
 

  • Field Details

    • parameterTypes

      private final Class<?>[] parameterTypes
  • Constructor Details

    • ParameterTypes

      private ParameterTypes(Class<?>[] parameterTypes)
  • Method Details

    • newParameterTypes

      static ParameterTypes newParameterTypes(Class<?>[] parameterTypes)
    • in

      public <T> Invoker<T> in(Class<T> target)
      Creates a new constructor invoker.
      Type Parameters:
      T - the generic type of the class containing the constructor to invoke.
      Parameters:
      target - the the type of object that the constructor invoker will create.
      Returns:
      the created constructor invoker.