Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.jasperreports.engine.util
Class JRSingletonCache

    java.lang.Object
      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 3034 2009-08-27 11:58:04Z teodord $
Author:
  Lucian Chirita (lucianc@users.sourceforge.net)

Constructor Summary
`JRSingletonCache(java.lang.Class itf)` Creates a cache of singleton instances.

Method Summary
`protected java.lang.Object` | `createInstance(java.lang.String className)`
`java.lang.Object` | `getCachedInstance(java.lang.String className)` Returns the singleton instance corresponding to a class.
`protected java.util.Map` | `getContextInstanceCache()`
`protected java.lang.Object` | `getContextKey()`

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`

### createInstance

    protected java.lang.Object createInstance(java.lang.String className)
                                       throws JRException

  Throws:
    `JRException`

### getContextInstanceCache

    protected java.util.Map getContextInstanceCache()

### getContextKey

    protected java.lang.Object getContextKey()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com