Top Description Fields Constructors Methods
net.sf.ehcache.store

public Class CopyStrategyHandler

extends Object
Class Inheritance
Known Direct Subclasses
net.sf.ehcache.store.TxCopyStrategyHandler
Imports
net.sf.ehcache.Element, net.sf.ehcache.store.compound.ReadWriteCopyStrategy

Utility class for handling element copy based on the copy on read and write configurations.
Author
ljacomet

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean
private final ReadWriteCopyStrategy<Element>
private final ClassLoader

Constructor Summary

AccessConstructor and Description
public
CopyStrategyHandler(boolean
copy on read flag
copyOnRead
,
boolean
copy on write flag
copyOnWrite
,
ReadWriteCopyStrategy<Element>
the copy strategy to use
copyStrategy
,
ClassLoader loader)

Creates a CopyStrategyHandler based on the copy configuration

Method Summary

Modifier and TypeMethod and Description
public Element

Returns:

a copy of the element with the reconstructed original value
copyElementForReadIfNeeded
(Element
the element to copy for read
element
)

Perform copy on read on an element if configured

pack-priv Element

Returns:

a copy of the element with a storage-ready value
copyElementForRemovalIfNeeded
(Element
the element to copy for removal
element
)

Perform copy for the element If both copy on read and copy on write are set to true

pack-priv Element

Returns:

a copy of the element with a storage-ready value
copyElementForWriteIfNeeded
(Element
the element to copy for write
element
)

Perform copy on write on an element if configured

pack-priv boolean

Returns:

true if copy needs to happen
isCopyActive
()

Returns wether copyOnRead or copyOnWrite is set

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

copyOnReadback to summary
private final boolean copyOnRead
copyOnWriteback to summary
private final boolean copyOnWrite
copyStrategyback to summary
private final ReadWriteCopyStrategy<Element> copyStrategy
loaderback to summary
private final ClassLoader loader

Constructor Detail

CopyStrategyHandlerback to summary
public CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader)

Creates a CopyStrategyHandler based on the copy configuration

Parameters
copyOnRead:boolean

copy on read flag

copyOnWrite:boolean

copy on write flag

copyStrategy:ReadWriteCopyStrategy<Element>

the copy strategy to use

Method Detail

copyElementForReadIfNeededback to summary
public Element copyElementForReadIfNeeded(Element element)

Perform copy on read on an element if configured

Parameters
element:Element

the element to copy for read

Returns:Element

a copy of the element with the reconstructed original value

copyElementForRemovalIfNeededback to summary
pack-priv Element copyElementForRemovalIfNeeded(Element element)

Perform copy for the element If both copy on read and copy on write are set to true

Parameters
element:Element

the element to copy for removal

Returns:Element

a copy of the element with a storage-ready value

copyElementForWriteIfNeededback to summary
pack-priv Element copyElementForWriteIfNeeded(Element element)

Perform copy on write on an element if configured

Parameters
element:Element

the element to copy for write

Returns:Element

a copy of the element with a storage-ready value

isCopyActiveback to summary
pack-priv boolean isCopyActive()

Returns wether copyOnRead or copyOnWrite is set

Returns:boolean

true if copy needs to happen