|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.jqno.equalsverifier.util.ConditionalPrefabValueBuilder
public class ConditionalPrefabValueBuilder
Builds prefab values for classes that may or may not be present on the
classpath.
Will try to create precisely two prefab values for a given class by calling
its constructor, a factory method, or a public static final constant declared
within the class, and add them to a PrefabValues
object.
If the class is not present on the classpath, or if calling any of its
members fails, it will result in a no-op. ConditionalPrefabValueBuilder will
not throw an exception.
Method Summary | |
---|---|
void |
addTo(PrefabValues prefabValues)
Adds two instances of the given type to a PrefabValues object. |
ConditionalPrefabValueBuilder |
callFactory(String factoryMethod,
Class<?>[] paramTypes,
Object[] paramValues)
Attempts to instantiate the given type by calling a factory method. |
ConditionalPrefabValueBuilder |
callFactory(String factoryType,
String factoryMethod,
Class<?>[] paramTypes,
Object[] paramValues)
Attempts to instantiate the given type by calling a factory method. |
ConditionalPrefabValueBuilder |
instantiate(Class<?>[] paramTypes,
Object[] paramValues)
Attempts to instantiate the given type by calling its constructor. |
ConditionalPrefabValueBuilder |
instantiate(Class<?>[] paramTypes,
PrefabValues prefabValues)
Attempts to instantiate the given type by calling its constructor. |
static ConditionalPrefabValueBuilder |
of(String fullyQualifiedClassName)
Factory method. |
ConditionalPrefabValueBuilder |
withConcreteClass(String fullyQualifiedClassName)
Provides a concrete implementing class in case the desired type is abstract or an interface. |
ConditionalPrefabValueBuilder |
withConstant(String constantName)
Attempts to obtain a reference to the given type by calling a public static final constant defined within the type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ConditionalPrefabValueBuilder of(String fullyQualifiedClassName)
fullyQualifiedClassName
- The fully qualified class name of the class for which we
intend to create prefab values.
public ConditionalPrefabValueBuilder withConcreteClass(String fullyQualifiedClassName)
fullyQualifiedClassName
- The fully qualified class name of the concrete implementing
class.
this
, for easy method chaining.public ConditionalPrefabValueBuilder instantiate(Class<?>[] paramTypes, Object[] paramValues)
paramTypes
- A list of types that identifies the constructor to be called.paramValues
- A list of values to pass to the constructor. Their types must
match the paramTypes
.
this
, for easy method chaining.public ConditionalPrefabValueBuilder instantiate(Class<?>[] paramTypes, PrefabValues prefabValues)
paramTypes
- A list of types that identifies the constructor to be called.prefabValues
- The PrefabValues
to draw values from.
this
, for easy method chaining.public ConditionalPrefabValueBuilder callFactory(String factoryMethod, Class<?>[] paramTypes, Object[] paramValues)
factoryMethod
- The name of the factory method.paramTypes
- A list of types that identifies the factory method's overload
to be called.paramValues
- A list of values to pass to the constructor. Their types must
match the paramTypes
.
this
, for easy method chaining.public ConditionalPrefabValueBuilder callFactory(String factoryType, String factoryMethod, Class<?>[] paramTypes, Object[] paramValues)
factoryType
- The type that contains the factory method.factoryMethod
- The name of the factory method.paramTypes
- A list of types that identifies the factory method's overload
to be called.paramValues
- A list of values to pass to the constructor. Their types must
match the paramTypes
.
this
, for easy method chaining.public ConditionalPrefabValueBuilder withConstant(String constantName)
constantName
- The name of the constant.
this
, for easy method chaining.public void addTo(PrefabValues prefabValues)
PrefabValues
object.
prefabValues
- The PrefabValues
object to add the instances to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |