portal.services
Class CachedServiceRef

java.lang.Object
  extended byportal.services.CachedServiceRef

public final class CachedServiceRef
extends java.lang.Object

Locating a service can be an expensive task, especially when it is done in a loop. This class caches a reference to a service.

Author:
Bavo De Ridder < bavo AT coderspotting DOT org >

Constructor Summary
CachedServiceRef(java.lang.Class interfaceRequired)
          Create a cached reference to a service.
 
Method Summary
 IService getService()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedServiceRef

public CachedServiceRef(java.lang.Class interfaceRequired)
                 throws ServiceException

Create a cached reference to a service.

Parameters:
interfaceRequired - The Class instance of the interface the service should implement
Throws:
ServiceException - thrown when the framework was unable to search for a service or when the service did not exist
Method Detail

getService

public IService getService()
Returns:
the cached reference to the service