Class JRClonePool


  • public class JRClonePool
    extends Object
    Working clones pooling utility used at fill time.
    Author:
    Lucian Chirita (lucianc@users.sourceforge.net)
    • Field Detail

      • EXCEPTION_MESSAGE_KEY_PARAMETER_NOT_FOUND

        public static final String EXCEPTION_MESSAGE_KEY_PARAMETER_NOT_FOUND
        See Also:
        Constant Field Values
    • Constructor Detail

      • JRClonePool

        public JRClonePool​(JRFillCloneable original,
                           boolean trackLockedClones,
                           boolean useOriginal)
        Creates a clone pool.
        Parameters:
        original - the original element that will be cloned
        trackLockedClones - whether to track clones retrieved from the pool

        If set, the pool will keep a set of in-use clones and the caller will always have to release the clones back to the pool.

        useOriginal - whether the original object can be used as a working clone
    • Method Detail

      • getClone

        public Object getClone()
        Retrieves a clone from the pool.

        The clone is reserved to the caller who will need to call releaseClone(Object) to release it back to the pool.

        Returns:
        a clone of the original object
      • releaseClone

        public void releaseClone​(Object clone)
        Release the clone back to the pool. The clone will be available for other clients.
        Parameters:
        clone - the clone to be released