Package net.sf.basedb.util.listable
Class SourceItemTransformerWithCache
java.lang.Object
net.sf.basedb.util.listable.SourceItemTransformerWithCache
- All Implemented Interfaces:
SourceItemTransformerFactory
This is a wrapper transformer factory that can be applied to any other
factory in order to provide support for caching.
The cache holds the result from
SourceItemTransformer.transform(TransformContext, Set)
so that if the same set of source ids are provided it will pick the cache result if
available and only forward to the wrapped factory in case no old result exists or if it
is too old.- Since:
- 3.16
- Author:
- Nicklas
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new source item transformer chain.SourceItemTransformerWithCache
(SourceItemTransformerFactory factory, String cacheRegion) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(Item sourceItemType, SyncFilter.SourceItemTransform transform) Create a source item transformed that can transform between the given source item and theSourceItemTransformerFactory.getTargetItem()
.Get the supported source item types when transforming in the specified direction.Get the target item type of this transformer factory.
-
Field Details
-
factory
-
cacheRegion
-
-
Constructor Details
-
SourceItemTransformerWithCache
Create a new source item transformer chain. The chain must contain at least one element and all steps must have matching source and target item types.- Throws:
IllegalArgumentException
- If the chain is null or empty or have non-matching transformation steps
-
SourceItemTransformerWithCache
-
-
Method Details
-
getTargetItem
Description copied from interface:SourceItemTransformerFactory
Get the target item type of this transformer factory. All transformers created by this factory are expected to have a matchingSourceItemTransformer.getTargetItemType()
.- Specified by:
getTargetItem
in interfaceSourceItemTransformerFactory
-
getSupportedSourceItems
Description copied from interface:SourceItemTransformerFactory
Get the supported source item types when transforming in the specified direction. TheSourceItemTransformerFactory.create(Item, SyncFilter.SourceItemTransform)
method should be able to create aSourceItemTransformer
for all of the item types returned by this method.- Specified by:
getSupportedSourceItems
in interfaceSourceItemTransformerFactory
-
create
Description copied from interface:SourceItemTransformerFactory
Create a source item transformed that can transform between the given source item and theSourceItemTransformerFactory.getTargetItem()
. Calling this method with an unsupported combination should result in a null return value.- Specified by:
create
in interfaceSourceItemTransformerFactory
-