org.jvnet.hk2.component
Interface Creator<T>
- All Superinterfaces:
- Binding<T>, Factory<T>, Holder<T>, Inhabitant<T>, ManagedComponentProvider<T>, Provider<T>
- All Known Implementing Classes:
- AbstractCreatorImpl, ConstructorCreator, ConstructorWomb, FactoryCreator, InjectableParametizedConstructorCreator
public interface Creator<T>
- extends Inhabitant<T>
Encapsulates how to create an object.
Signature-wise it's the same as Inhabitant
but it carries an additional meaning.
- Author:
- Kohsuke Kawaguchi
- See Also:
Creators
| Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder |
Holder.Impl<T> |
get
T get()
throws ComponentException
- Short cut for
T o = create();
initialize(o);
return o;
- Specified by:
get in interface Factory<T>- Specified by:
get in interface Inhabitant<T>- Specified by:
get in interface Provider<T>
- Throws:
ComponentException
create
T create(Inhabitant onBehalfOf)
throws ComponentException
- Creates a new instance.
The caller is supposed to call the
initialize(Object, Inhabitant)
right away. This 2-phase initialization allows us to handle
cycle references correctly.
- Parameters:
onBehalfOf -
- Throws:
ComponentException
initialize
void initialize(T t,
Inhabitant onBehalfOf)
throws ComponentException
- Performs initialization of object, such as dependency injection.
- Throws:
ComponentException
Copyright © 2011 Oracle Corporation. All Rights Reserved.