org.glassfish.hk2.api
Interface ServiceHandle<T>

Type Parameters:
T - The type of the service that can be returned
All Known Implementing Classes:
ServiceHandleImpl

public interface ServiceHandle<T>

This service handle can be used to get a specific instance of a service, and can be used to destroy that service as well

Author:
jwells

Method Summary
 void destroy()
          Will destroy this object and all PerLookup instances created because of this service
 ActiveDescriptor<T> getActiveDescriptor()
          Returns the ActiveDescriptor associated with this service handle
 T getService()
          Gets the underlying service object
 boolean isActive()
          This returns true if the underlying service has already been created
 

Method Detail

getService

T getService()
Gets the underlying service object

Returns:
May return null (if the backing ActiveDescriptor returned null)
Throws:
MultiException - if there was an error creating the service
IllegalStateException - if the handle was previously destroyed

getActiveDescriptor

ActiveDescriptor<T> getActiveDescriptor()
Returns the ActiveDescriptor associated with this service handle

Returns:
The ActiveDescriptor associated with this handle

isActive

boolean isActive()
This returns true if the underlying service has already been created

Returns:
true if the underlying service has been created

destroy

void destroy()
Will destroy this object and all PerLookup instances created because of this service



Copyright © 2013 Oracle Corporation. All Rights Reserved.