Package net.sf.basedb.util.listable
Class RestrictionTransformer
- java.lang.Object
-
- net.sf.basedb.util.listable.AbstractSourceItemTransformer
-
- net.sf.basedb.util.listable.RestrictionTransformer
-
- All Implemented Interfaces:
SourceItemTransformer
public class RestrictionTransformer extends AbstractSourceItemTransformer
Transformer implementation that is intended to provide a final filtering of target items. The transformer is used by wrapping an existing source item transformer implementation. Thetransform(TransformContext, Set)
method will first call the wrapped transformer to get a list of target items and then apply the given filter before returning the result.- Since:
- 3.18
- Author:
- nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private ItemQuery<?>
query
private SourceItemTransformer
transformer
-
Constructor Summary
Constructors Constructor Description RestrictionTransformer(SourceItemTransformer transformer, ItemQuery<?> query)
Create a new transformer and use the given query to find the target items.RestrictionTransformer(SourceItemTransformer transformer, Restriction restriction)
Create a new transformer and apply the given restriction to items before they are returned.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Integer>
transform(TransformContext context, Set<Integer> source)
Transform the given set of source item ID:s into a set of target item ID:s-
Methods inherited from class net.sf.basedb.util.listable.AbstractSourceItemTransformer
getSourceItemType, getTargetItemType, safeIdList
-
-
-
-
Field Detail
-
transformer
private final SourceItemTransformer transformer
-
query
private final ItemQuery<?> query
-
-
Constructor Detail
-
RestrictionTransformer
public RestrictionTransformer(SourceItemTransformer transformer, Restriction restriction)
Create a new transformer and apply the given restriction to items before they are returned. AnItemQuery
for the correct target item type is automatically created from the given transformer. The restriction is applied to the query before it is executed.
-
RestrictionTransformer
public RestrictionTransformer(SourceItemTransformer transformer, ItemQuery<?> query)
Create a new transformer and use the given query to find the target items. The query is expected to return the same type of items as the transformer and must have defined a parameter with the name 'ids' that take a list of id values. The list will be populated with the id values returned by the transformer.
-
-
Method Detail
-
transform
public Set<Integer> transform(TransformContext context, Set<Integer> source)
Description copied from interface:SourceItemTransformer
Transform the given set of source item ID:s into a set of target item ID:s
-
-