PropertyCache (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.fo.properties

## Class PropertyCache<T>

- java.lang.Object
- - org.apache.fop.fo.properties.PropertyCache<T>

- Type Parameters:
    `T` - The type of values that are cached

      public final class PropertyCache<T>
      extends 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

    Constructors
    Constructor and Description
    `PropertyCache()` Creates a new cache.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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

Copyright © 2025 Apache Software Foundation. All rights reserved.