|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectBuilder<T>
From the ObjectBuilderFactory you can create ObjectBuilder instances. These are used to
instantiate objects, i.e. instances of plain Java classes. You can either create a new
instance using newInstance()
, or perform dependency
injection on an already available instance using injectTo(Object)
(note that constructor injection
will not be performed in this case), or you can use the builder for the prototype pattern
by using it as an iterable, where each call to next() will create a new instance.
Method Summary | |
---|---|
void |
injectTo(T instance)
Inject an existing instance. |
T |
newInstance()
Creates a new instance from this ObjectBuilder. |
ObjectBuilder<T> |
use(Object... objects)
Make the given objects available for @Uses injection. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
ObjectBuilder<T> use(Object... objects)
These objects will be injected to the @Uses fields and arguments, when the object is created (constructor injection) or just has been created (field injection).
It is possible to provide more objects in the use()
method than is actually
required. Any additional objects will be discarded before the Application.activate() method
is called, and eventually garbage collected.
objects
- the objects to be used
T newInstance() throws ConstructionException
T
.
ConstructionException
- If the object class is not compatible with thevoid injectTo(T instance) throws ConstructionException
instance
-
ConstructionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |