public abstract class ObjectFactory extends Object
Modifier and Type | Method and Description |
---|---|
protected static <E> Constructor<E> |
getConstructor(Class<E> klass,
Object[] allParameters,
List<Object> parameters)
Finds a constructor in a class that has a signature that includes some the parameters in the parameter list on a best match principal.
|
static <E> E |
getObject(Class<E> klass,
Object... allParameters)
This method instantiates a class based on the solid implementation class passed as a parameter and the parameters.
|
public static <E> E getObject(Class<E> klass, Object... allParameters)
E
- the desired class to be instantiatedklass
- the class to be instantiatedallParameters
- the parameters for the constructor, these cannot be primitives and the parameters in the constructor have to be objects as well, not
primitivesprotected static <E> Constructor<E> getConstructor(Class<E> klass, Object[] allParameters, List<Object> parameters)
E
- the type to returnklass
- the class look for a constructor inallParameters
- all the parameters that are available for the constructorparameters
- the parameters that were collected for the best match constructorCopyright © 2016–2020. All rights reserved.