Class BuilderConstructorBasedInstantiator<T>
java.lang.Object
de.cuioss.test.valueobjects.objects.impl.BuilderConstructorBasedInstantiator<T>
- Type Parameters:
T
- identifying the type of theObject
created by the builder
- All Implemented Interfaces:
BuilderInstantiator<T>
public class BuilderConstructorBasedInstantiator<T>
extends Object
implements BuilderInstantiator<T>
Used for creating instances of a builder. This variant relies on the
builder-class having a parameter-free constructor.
- Author:
- Oliver Wolff
-
Constructor Summary
ConstructorsConstructorDescriptionBuilderConstructorBasedInstantiator
(Class<?> builderType) Constructor.BuilderConstructorBasedInstantiator
(Class<?> builderType, String buildMethodName) 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
-
BuilderConstructorBasedInstantiator
Constructor. Shortcut for callingBuilderConstructorBasedInstantiator(Class, String)
withBuilderContractImpl.DEFAULT_BUILD_METHOD_NAME
- Parameters:
builderType
- identifying the actual type of the builder. It is assumed that it provides is parameter-free public constructor
-
BuilderConstructorBasedInstantiator
Constructor.- Parameters:
builderType
- identifying the actual type of the builder. It is assumed that it provides is parameter-free public constructorbuildMethodName
- the actual name or the builder-method, must not be null nor empty
-
-
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
-