T
- the class the instances of which will be created by this Instantiatorpublic interface Instantiator<T>
This class provides a convenient way of repeatable creation of instances without the need of repeatable inspection of the target class.
Modifier and Type | Method and Description |
---|---|
java.lang.Class<? extends T> |
getInstantiatorClass()
Returns the class instantiated by this Instantiator.
|
java.lang.Class<?>[] |
getInstantiatorPrototype()
Returns the classes of arguments for the
instantiate(java.lang.Object[]) method. |
T |
instantiate(java.lang.Object... arguments)
Creates an instance for the given arguments.
|
T instantiate(java.lang.Object... arguments) throws java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
arguments
- the arguments for the instancejava.lang.IllegalArgumentException
- if the arguments are not compatiblejava.lang.reflect.InvocationTargetException
- if there was an exception thrown when the instance was createdjava.lang.Class<? extends T> getInstantiatorClass()
java.lang.Class<?>[] getInstantiatorPrototype()
instantiate(java.lang.Object[])
method.