Class BuilderFactoryBasedInstantiator<T>
java.lang.Object
de.cuioss.test.valueobjects.objects.impl.BuilderFactoryBasedInstantiator<T>
- Type Parameters:
T
- identifying the type of theObject
created by the builder
- All Implemented Interfaces:
BuilderInstantiator<T>
Used for creating instances of a builder. This variant relies on a factory
method on the target type usually with the name "builder". See
BuilderFactoryBasedInstantiator(Class, String, String)
for details- Author:
- Oliver Wolff
-
Constructor Summary
ConstructorsConstructorDescriptionBuilderFactoryBasedInstantiator
(Class<?> enclosingType) Constructor.BuilderFactoryBasedInstantiator
(Class<?> enclosingType, String builderFactoryMethodName, String builderMethodName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionActually builds the target objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.cuioss.test.valueobjects.objects.BuilderInstantiator
getBuilderClass, getTargetClass
-
Constructor Details
-
BuilderFactoryBasedInstantiator
Constructor. shortcut for callingBuilderFactoryBasedInstantiator(Class, String, String)
withBuilderContractImpl.DEFAULT_BUILDER_FACTORY_METHOD_NAME
and "build"- Parameters:
enclosingType
- identifying the type where the method is located in, must not be null.
-
BuilderFactoryBasedInstantiator
public BuilderFactoryBasedInstantiator(Class<?> enclosingType, String builderFactoryMethodName, String builderMethodName) Constructor.- Parameters:
enclosingType
- identifying the type where the method is located in, must not be null.builderFactoryMethodName
- The name of the factory method on the enclosing type. It is assumed that it is parameter-free static methodbuilderMethodName
- the actual name or the builder-method
-
-
Method Details
-
newBuilderInstance
- Specified by:
newBuilderInstance
in interfaceBuilderInstantiator<T>
- Returns:
- a newly created builder.
-
build
Description copied from interface:BuilderInstantiator
Actually builds the target object- Specified by:
build
in interfaceBuilderInstantiator<T>
- Returns:
- the Object created by the contained builder
-