org.jvnet.hk2.internal
Class ServiceHandleImpl<T>

java.lang.Object
  extended by org.jvnet.hk2.internal.ServiceHandleImpl<T>
Type Parameters:
T - The type of service to create
All Implemented Interfaces:
ServiceHandle<T>

public class ServiceHandleImpl<T>
extends Object
implements ServiceHandle<T>

This handle does the underlying work of getting the service. Only at the time that the getService call is made is the service gotten from the context. Once a service has been gotten, it is not looked up again.

Author:
jwells

Method Summary
 void addSubHandle(ServiceHandleImpl<?> subHandle)
          Add a sub handle to this for proper destruction
 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
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getService

public T getService()
Description copied from interface: ServiceHandle
Gets the underlying service object

Specified by:
getService in interface ServiceHandle<T>
Returns:
May return null (if the backing ActiveDescriptor returned null)

getActiveDescriptor

public ActiveDescriptor<T> getActiveDescriptor()
Description copied from interface: ServiceHandle
Returns the ActiveDescriptor associated with this service handle

Specified by:
getActiveDescriptor in interface ServiceHandle<T>
Returns:
The ActiveDescriptor associated with this handle

isActive

public boolean isActive()
Description copied from interface: ServiceHandle
This returns true if the underlying service has already been created

Specified by:
isActive in interface ServiceHandle<T>
Returns:
true if the underlying service has been created

destroy

public void destroy()
Description copied from interface: ServiceHandle
Will destroy this object and all PerLookup instances created because of this service

Specified by:
destroy in interface ServiceHandle<T>

addSubHandle

public void addSubHandle(ServiceHandleImpl<?> subHandle)
Add a sub handle to this for proper destruction

Parameters:
subHandle - A handle to add for proper destruction

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Oracle Corporation. All Rights Reserved.