r01f.reflection.fluent
Class ConstructorReflection
java.lang.Object
r01f.reflection.fluent.ConstructorReflection
public final class ConstructorReflection
- extends java.lang.Object
Constructor Reflection
Usage example:
// Equivalent to call 'new MyObj()'
MyObj p = Reflection.constructor().in(MyObj.class).newInstance();
// Equivalent to call 'new MyObj("myStrParam")'
Person p = Reflection.constructor().withParameterTypes(String.class).in(MyObj.class).newInstance("myStrParam");
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConstructorReflection
public ConstructorReflection()
startConstructorAccess
static ConstructorReflection startConstructorAccess()
in
public static <T> ConstructorInvoker<T> in(java.lang.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.
withParameterTypes
public static ConstructorParameterTypes withParameterTypes(java.lang.Class<?>... parameterTypes)
- Specifies the parameter types for the constructor to invoke.
This method call is optional if the constructor to call does not accept arguments.
- Parameters:
parameterTypes - the types of the parameters to pass to the constructor.
- Returns:
- the created parameter type holder.
- Throws:
java.lang.NullPointerException - if the given array is null.