fop 2.3

org.apache.fop.fo.properties
Class PropertyCache<T>

java.lang.Object
  extended by org.apache.fop.fo.properties.PropertyCache<T>
Type Parameters:
T - The type of values that are cached

public final class PropertyCache<T>
extends java.lang.Object

Thread-safe cache that minimizes the memory requirements by fetching an instance from the cache that is equal to the given one. Internally the instances are stored in WeakReferences in order to be reclaimed when they are no longer referenced.


Constructor Summary
PropertyCache()
          Creates a new cache.
 
Method Summary
 T fetch(T obj)
          Returns a cached version of the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyCache

public PropertyCache()
Creates a new cache. The "org.apache.fop.fo.properties.use-cache" system property is used to determine whether properties should actually be cached or not. If not, then the fetch(Object) method will simply return its argument. To enable the cache, set this property to "true" (case insensitive).

Method Detail

fetch

public T fetch(T obj)
Returns a cached version of the given object. If the object is not yet in the cache, it will be added and then returned.

Parameters:
obj - an object
Returns:
a cached version of the object

fop 2.3

Copyright 1999-2018 The Apache Software Foundation. All Rights Reserved.