public abstract class Instantiators
extends java.lang.Object
Instantiator
s.Constructor and Description |
---|
Instantiators() |
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Method |
getPropertyGetterMethod(java.lang.Class<?> clazz,
java.lang.String propertyName)
Retrieves a getter method for a given property on a given bean class.
|
static java.lang.reflect.Method |
getPropertySetterMethod(java.lang.Class<?> clazz,
java.lang.String propertyName,
java.lang.Class<?> propertyClass)
Retrieves a setter method for a given property on a given bean class.
|
static boolean |
isPrototypeMatching(java.lang.Class<?>[] methodTypes,
java.lang.Class<?>[] methodPrototype)
Test argument array, if it is compatible with the provided prototype.
|
static boolean |
isPrototypeMatching(java.lang.Class<?>[] methodTypes,
java.lang.Class<?>[] methodPrototype,
int skipIndex)
Test argument array, if it is compatible with the provided prototype.
|
static java.lang.String |
isPrototypeMatching(java.lang.Class<?>[] prototype,
java.lang.Object[] arguments,
boolean convertStringArguments,
java.util.Map<java.lang.String,?> namedInstances)
Test argument array, if it is compatible with the provided prototype.
|
static java.lang.Class<?>[] |
varargExpandPrototype(java.lang.Class<?>[] methodTypes,
int actualArgumentCount)
Expands a variable-argument method/constructor prototype to the actual number of arguments.
|
static java.lang.Object[] |
varargShrinkValues(java.lang.Class<?>[] methodTypes,
java.lang.Object[] arguments)
Shrink the variable-argument method/constructor argument values to the actual method/constructor prototype.
|
public static java.lang.reflect.Method getPropertyGetterMethod(java.lang.Class<?> clazz, java.lang.String propertyName) throws java.lang.IllegalArgumentException
clazz
- the bean class to usepropertyName
- the name of the propertyjava.lang.IllegalArgumentException
- if there was no public getter method for the given property namepublic static java.lang.reflect.Method getPropertySetterMethod(java.lang.Class<?> clazz, java.lang.String propertyName, java.lang.Class<?> propertyClass) throws java.lang.IllegalArgumentException
clazz
- the bean class to usepropertyName
- the name of the propertypropertyClass
- the class of the propertyjava.lang.IllegalArgumentException
- if there was no public getter method for the given property namepublic static java.lang.Class<?>[] varargExpandPrototype(java.lang.Class<?>[] methodTypes, int actualArgumentCount)
methodTypes
- the method/constructor prototypeactualArgumentCount
- the actual number of arguments to expand the prototype topublic static java.lang.Object[] varargShrinkValues(java.lang.Class<?>[] methodTypes, java.lang.Object[] arguments)
methodTypes
- the method/constructor prototypearguments
- the argument values for the method/constructorpublic static boolean isPrototypeMatching(java.lang.Class<?>[] methodTypes, java.lang.Class<?>[] methodPrototype, int skipIndex)
methodTypes
) must be assignable
from the respective methodPrototype
item.methodTypes
- the tested arguments arraymethodPrototype
- the prototype arguments arrayskipIndex
- the index of an argument that is not checked for the compatibility conditionpublic static boolean isPrototypeMatching(java.lang.Class<?>[] methodTypes, java.lang.Class<?>[] methodPrototype)
methodTypes
must be assignable
from the respective methodPrototype
item.methodTypes
- the tested arguments arraymethodPrototype
- the prototype arguments arraypublic static java.lang.String isPrototypeMatching(java.lang.Class<?>[] prototype, java.lang.Object[] arguments, boolean convertStringArguments, java.util.Map<java.lang.String,?> namedInstances)
prototype
item.
If the convertStringArguments
is specified, the
arguments
elements are replaced with the converted types
if and only if the method returns true.prototype
- the tested prototypearguments
- the tested argumentsconvertStringArguments
- if true the string values from the arguments are converted using Convert.stringToType(java.lang.String, java.lang.Class<E>, java.util.Map<java.lang.String, ? extends java.lang.Object>)
namedInstances
- map of named instances - an instance from this map is returned if the string
matches a key in the map