|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.jqno.equalsverifier.util.ConditionalInstantiator
public class ConditionalInstantiator
Allows instantiation of classes that may or may not be present on the classpath.
Constructor Summary | |
---|---|
ConditionalInstantiator(String fullyQualifiedClassName)
Constructor. |
Method Summary | |
---|---|
Object |
callFactory(String factoryMethod,
Class<?>[] paramTypes,
Object[] paramValues)
Attempts to call a static factory method on the type. |
Object |
callFactory(String factoryTypeName,
String factoryMethod,
Class<?>[] paramTypes,
Object[] paramValues)
Attempts to call a static factory method on a type. |
static Class<?>[] |
classes(Class<?>... classes)
Helper method to create an array of Classes. |
static Class<?> |
forName(String className)
Helper method to resolve a Class of a given name. |
Object |
instantiate(Class<?>[] paramTypes,
Object[] paramValues)
Attempts to instantiate the type. |
static Object[] |
objects(Object... objects)
Helper method to create an array of Objects. |
Class<?> |
resolve()
Attempts to resolve the type. |
Object |
returnConstant(String constantName)
Attempts to resolve a static constant on the type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConditionalInstantiator(String fullyQualifiedClassName)
fullyQualifiedClassName
- The fully-qualified name of the class that we intend to
instantiate.Method Detail |
---|
public Class<?> resolve()
public Object instantiate(Class<?>[] paramTypes, Object[] paramValues)
paramTypes
- The types of the constructor parameters of the constructor
that we want to call.paramValues
- The values that we want to pass into the constructor.
ReflectionException
- If instantiation fails.public Object callFactory(String factoryMethod, Class<?>[] paramTypes, Object[] paramValues)
factoryMethod
- The name of the factory method.paramTypes
- The types of the parameters of the specific overload of the
factory method we want to call.paramValues
- The values that we want to pass into the factory method.
ReflectionException
- If the call to the factory method fails.public Object callFactory(String factoryTypeName, String factoryMethod, Class<?>[] paramTypes, Object[] paramValues)
factoryTypeName
- The type that contains the factory method.factoryMethod
- The name of the factory method.paramTypes
- The types of the parameters of the specific overload of the
factory method we want to call.paramValues
- The values that we want to pass into the factory method.
ReflectionException
- If the call to the factory method fails.public Object returnConstant(String constantName)
constantName
- The name of the constant.
ReflectionException
- If resolving the constant fails.public static Class<?>[] classes(Class<?>... classes)
classes
- The classes to construct an array out of.
public static Object[] objects(Object... objects)
objects
- The objects to construct an array out of.
public static Class<?> forName(String className)
className
- The fully qualified name of the class to resolve.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |