Package net.orbyfied.coldlib.util
Class Assembly<I,T,O>
java.lang.Object
net.orbyfied.coldlib.util.Assembly<I,T,O>
- Type Parameters:
I- The intermediate type.T- The result type (finalized).O- The options type.
Pipeline for creating and initializing
an instance of type
R with options
of type O.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for an assembly.static interfaceResponsible for creating an instance, taking in account the provided options.static classA pipeline or assembly line which will transform the instance of typeTby passing it through a line ofAssembly.Transformers.static interfaceOne transformer/handler in a line. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe function which provides the default options object.The finalizer function.protected final Assembly.InstanceFactory<I,O> The instance factory responsible for creating the first instance.protected final Assembly.Line<I,O> The pipeline to transform the intermediate instance.protected final Assembly.Line<T,O> The pipeline to transform the result instance. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Assembles (creates, initializes, prepares) a new instance of typeTwith the default options.Assembles (creates, initializes, prepares) a new instance of typeTwith the provided options (nullable).static <I,T, O> Assembly.Builder<I, T, O> Create a new builder instance.protected OGet the default options if defined.Creates a new builder with the properties of this instance set.
-
Field Details
-
defaultOptionProvider
The function which provides the default options object. This can be null or return null, in that case null will be used as the default options. -
instanceFactory
The instance factory responsible for creating the first instance. -
intermediateLine
The pipeline to transform the intermediate instance. -
finalizer
The finalizer function. -
resultLine
The pipeline to transform the result instance.
-
-
Method Details
-
getDefaultOptions
Get the default options if defined.- Returns:
- The default options or null (also valid).
-
build
Assembles (creates, initializes, prepares) a new instance of typeTwith the default options.- Returns:
- The built instance.
- See Also:
-
build
Assembles (creates, initializes, prepares) a new instance of typeTwith the provided options (nullable).- Parameters:
options- The options to assemble with. Can be null.- Returns:
- The built instance.
-
toBuilder
Creates a new builder with the properties of this instance set.- Returns:
- The builder instance.
-
getIntermediateType
-
getResultType
-
getOptionsType
-
builder
public static <I,T, Assembly.Builder<I,O> T, builderO> (Class<I> iClass, Class<T> tClass, Class<O> oClass) Create a new builder instance.- Type Parameters:
I- The intermediate type.T- The result type.O- The options type.- Parameters:
iClass- The intermediate type.tClass- The result type.oClass- The options type.- Returns:
- The builder instance.
-