org.qi4j.api.composite
Interface TransientBuilder<T>

All Superinterfaces:
Iterable<T>

public interface TransientBuilder<T>
extends Iterable<T>

TransientBuilders are used to instantiate TransientComposites. They can be acquired from TransientBuilderFactory.newTransientBuilder(Class) and allows the client to provide additional settings before instantiating the TransientComposite.

It extends Iterable which allows client code to iteratively create new instances. This can be used to implement the prototype pattern.


Method Summary
 T newInstance()
          Create a new Composite instance.
 T prototype()
          Get a representation of the state for the new Composite.
<K> K
prototypeFor(Class<K> mixinType)
          Get a representation of the state of the given type for the new Composite.
 TransientBuilder<T> use(Object... usedObjects)
          Provide objects that can be injected into mixins that has the @Uses dependency injection annotation.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

use

TransientBuilder<T> use(Object... usedObjects)
Provide objects that can be injected into mixins that has the @Uses dependency injection annotation.

Parameters:
usedObjects - The objects that can be injected into mixins.
Returns:
the transient builder instance
See Also:
Uses

prototype

T prototype()
Get a representation of the state for the new Composite. It is possible to access and update properties and associations, even immutable ones since the builder represents the initial state.

Returns:
a proxy implementing the Composite type

prototypeFor

<K> K prototypeFor(Class<K> mixinType)
Get a representation of the state of the given type for the new Composite. This is primarily used if you want to provide state for a private mixin type.

Parameters:
mixinType - the mixin which you want to provide state for
Returns:
a proxy implementing the given mixin type

newInstance

T newInstance()
              throws ConstructionException
Create a new Composite instance.

Returns:
a new Composite instance
Throws:
ConstructionException - thrown if it was not possible to instantiate the Composite