Package net.sf.basedb.util.listable
Class SourceItemTransformerChain
- java.lang.Object
-
- net.sf.basedb.util.listable.SourceItemTransformerChain
-
- All Implemented Interfaces:
SourceItemTransformer
public class SourceItemTransformerChain extends Object implements SourceItemTransformer
Chains together one or more source item transformers. Each step in the chain should take over from the previous in the sense that theSourceItemTransformer.getSourceItemType()
of step N+1 must match theSourceItemTransformer.getTargetItemType()
of step N.- Since:
- 3.5
- Author:
- Nicklas
-
-
Constructor Summary
Constructors Constructor Description SourceItemTransformerChain(List<SourceItemTransformer> chain)
Create a new source item transformer chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Set<Integer>
appendFakeSources(Set<Integer> existing)
Item
getSourceItemType()
Get the source item type of the first step in the chain.Item
getTargetItemType()
Get the target item type of the last step in the chain.Set<Integer>
transform(TransformContext context, Set<Integer> source)
Transform the source items into target items by invoking each step in the transformer chain.
-
-
-
Field Detail
-
chain
private final List<SourceItemTransformer> chain
-
source
private final Item source
-
target
private final Item target
-
-
Constructor Detail
-
SourceItemTransformerChain
public SourceItemTransformerChain(List<SourceItemTransformer> chain)
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
-
-
Method Detail
-
getSourceItemType
public Item getSourceItemType()
Get the source item type of the first step in the chain.- Specified by:
getSourceItemType
in interfaceSourceItemTransformer
-
getTargetItemType
public Item getTargetItemType()
Get the target item type of the last step in the chain.- Specified by:
getTargetItemType
in interfaceSourceItemTransformer
-
transform
public Set<Integer> transform(TransformContext context, Set<Integer> source)
Transform the source items into target items by invoking each step in the transformer chain.- Specified by:
transform
in interfaceSourceItemTransformer
-
-