SRC
- The context which may influence the object being created by this
factory.@FunctionalInterface public interface UnmarshalFactory<SRC>
UnmarshalFactory
defines the functionality which must be provided
in order to represent a factory for object creation of an object being of a
requested type (in contrast to the TypeFactory
and the
SelectorFactory
from an instance of a provided type. Many alternative
implementations of a UnmarshalFactory
may may exist which construct
the instances their way.
Having factories that generic as we define it here, we are able to decouple
our business logic from any specific framework: Your business logic must not
know anything about how the instance are generated. It mainly just needs to
know how to use the UnmarshalFactory
. It is up to the application
"end point", i.e. a command line tool with a main-method or a web-application
to finally decide which factory to use.
Depending on the implementation used or configuration provided, the
UnmarshalFactory
may return singletons or dedicated separate
instances when queried for instances.
Modifier and Type | Method and Description |
---|---|
default Object |
toUnmarshaled(SRC aContext,
Class<?>... aTypes)
This method creates / retrieves an instance of one of the given types
from the provided instance.
|
<T> T |
toUnmarshaled(SRC aContext,
Class<T> aType)
This method creates / retrieves an instance of the given type from the
provided instance.
|
default <T> T |
toUnmarshaled(SRC aContext,
Class<T> aType,
org.refcodes.collection.Properties aProperties)
This method creates / retrieves all instances of the given type.
|
default Object |
toUnmarshaled(SRC aContext,
org.refcodes.collection.Properties aProperties,
Class<?>... aTypes)
This method creates / retrieves an instance of one of the given types
from the provided instance.
|
<T> T toUnmarshaled(SRC aContext, Class<T> aType) throws org.refcodes.exception.UnmarshalException
SRC
- The context which may influence the object being created by
this factory.T
- The type which is to be fabricated by the factory method.aContext
- The context which may influence the object being created
by this factory.aType
- The type identifying the instance to be created / retrieved.org.refcodes.exception.UnmarshalException
- Thrown when unmarshaling / deserializing an
object fails.default Object toUnmarshaled(SRC aContext, Class<?>... aTypes) throws org.refcodes.exception.UnmarshalException
SRC
- The context which may influence the object being created by
this factory.T
- The type which is to be fabricated by the factory method.aContext
- The context which may influence the object being created
by this factory.aTypes
- The types identifying the instance to be created /
retrieved.org.refcodes.exception.UnmarshalException
- Thrown when unmarshaling / deserializing for
all provided types failed.default Object toUnmarshaled(SRC aContext, org.refcodes.collection.Properties aProperties, Class<?>... aTypes) throws org.refcodes.exception.UnmarshalException
SRC
- The context which may influence the object being created by
this factory.T
- The type which is to be fabricated by the factory method.aContext
- The context which may influence the object being created
by this factory.aTypes
- The types identifying the instance to be created /
retrieved.aProperties
- The dynamic properties which are used to configure the
desired bean.org.refcodes.exception.UnmarshalException
- Thrown when unmarshaling / deserializing for
all provided types failed.default <T> T toUnmarshaled(SRC aContext, Class<T> aType, org.refcodes.collection.Properties aProperties) throws org.refcodes.exception.UnmarshalException
T
- The type which is to be fabricated by the factory method.aContext
- The context which may influence the object being created
by this factory.aType
- The type identifying the instances to be created /
retrieved.aProperties
- The dynamic properties which are used to configure the
desired bean.org.refcodes.exception.UnmarshalException
- Thrown when unmarshaling / deserializing an
object fails.Copyright © 2017. All rights reserved.