net.sf.jasperreports.engine.util
Class JRSingletonCache

java.lang.Object
  extended by net.sf.jasperreports.engine.util.JRSingletonCache

public class JRSingletonCache
extends java.lang.Object

Utility to use as a soft cache of singleton instances.

Version:
$Id: JRSingletonCache.java 1245 2006-04-28 11:23:04 +0300 (Fri, 28 Apr 2006) lucianc $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Constructor Summary
JRSingletonCache(java.lang.Class itf)
          Creates a cache of singleton instances.
 
Method Summary
 java.lang.Object getCachedInstance(java.lang.String className)
          Returns the singleton instance corresponding to a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRSingletonCache

public JRSingletonCache(java.lang.Class itf)
Creates a cache of singleton instances.

Parameters:
itf - a interface or class that should be implemented by all classes cached by this object
Method Detail

getCachedInstance

public java.lang.Object getCachedInstance(java.lang.String className)
                                   throws JRException
Returns the singleton instance corresponding to a class.

The instance is first searched into the cache and created if not found.

The class is expected to have a no-argument constructor.

Parameters:
className -
Returns:
the singleton instance corresponding to a class
Throws:
JRException


© 2001-2006 JasperSoft Corporation www.jaspersoft.com