org.glassfish.hk2
Interface ScopeInstance


public interface ScopeInstance

A particular instantiation of a Scope. Will be used to store and retrieve components for that particular Scope

For example, for the "request scope", an instance of ScopeInstance is created for each request.

Author:
Jerome Dochez
See Also:
Scope.current()

Method Summary
<T> T
get(Provider<T> provider)
          Retrieves a stored inhabitant if present in the storage bag.
<T> T
put(Provider<T> provider, T value)
          Stores a inhabitant component instance.
 void release()
          release the backend storage and call PreDestroy.preDestroy() on all instantiated components that implement the PreDestroy interface.
 

Method Detail

get

<T> T get(Provider<T> provider)
Retrieves a stored inhabitant if present in the storage bag.

Type Parameters:
T - the requested instance type
Parameters:
provider - the Provider we request the instance for.
Returns:
the instance of T for that provider or null if it was never added to the bug.

put

<T> T put(Provider<T> provider,
          T value)
Stores a inhabitant component instance.

Type Parameters:
T - type of the component
Parameters:
provider - component description as an Provider
value - component instance
Returns:
the previous value associated with this provider if any,

release

void release()
release the backend storage and call PreDestroy.preDestroy() on all instantiated components that implement the PreDestroy interface.



Copyright © 2011 Oracle Corporation. All Rights Reserved.