org.jvnet.hk2.component
Interface Creator<T>
- All Superinterfaces:
- Binding<T>, Descriptor, Factory<T>, Holder<T>, Inhabitant<T>, ManagedComponentProvider<T>, Provider<T>, Releasable
- All Known Implementing Classes:
- AbstractCreatorImpl, ConstructorCreator, CreatorImpl
Deprecated.
@Deprecated
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> |
Method Summary |
T |
create(Inhabitant onBehalfOf)
Deprecated. Creates a new instance. |
T |
get()
Deprecated. Short cut for |
void |
initialize(T t,
Inhabitant onBehalfOf)
Deprecated. Performs initialization of object, such as dependency injection. |
Methods inherited from interface org.glassfish.hk2.api.Descriptor |
getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, setRanking |
get
T get()
throws ComponentException
- Deprecated.
- 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>
- Returns:
- null is a valid return value. This is useful
when a factory primarily does a look-up and it fails
to find the specified component, yet you don't want that
by itself to be an error. If the injection wants
a non-null value (i.e., @Inject(optional=false)).
- Throws:
ComponentException
- If the factory failed to get/create an instance
and would like to propagate the error to the caller.
ComponentException
create
T create(Inhabitant onBehalfOf)
throws ComponentException
- Deprecated.
- 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
- Deprecated.
- Performs initialization of object, such as dependency injection.
- Throws:
ComponentException
Copyright © 2013 Oracle Corporation. All Rights Reserved.