public class CompositeItemFilter extends Object implements ItemFilter
ItemFilter implementation. Calls ItemFilters before processing and after processing,
depending on what their ItemFilter.runBeforeProcessing() and ItemFilter.runAfterProcessing() methods
return.| Constructor and Description |
|---|
CompositeItemFilter()
Creates a composite filter with a
null list of ItemFilters. |
CompositeItemFilter(ItemFilter... filters)
Creates a composite filter with the specified array of
ItemFilters. |
CompositeItemFilter(List<ItemFilter> filters)
Creates a composite filter with the specified list of
ItemFilters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepts(Item item,
List<Item> acceptedItems,
List<Item> rejectedItems,
boolean runningBeforeProcessing)
If
runningBeforeProcessing is true, calls all filters that need to be run before processing. |
void |
addFilter(ItemFilter filter)
Adds the specified
ItemFilter to the filter list, creating the list if necessary. |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
removeFilter(ItemFilter filter)
Removes the specified
ItemFilter from the filter list, only if the list is not null. |
boolean |
runAfterProcessing()
Always returns true so that filters that need to run after processing are called.
|
boolean |
runBeforeProcessing()
Always returns true so that filters that need to run before processing are called.
|
void |
setFilters(List<ItemFilter> filters)
Sets the list of filters.
|
String |
toString() |
public CompositeItemFilter()
null list of ItemFilters.public CompositeItemFilter(List<ItemFilter> filters)
ItemFilters.public CompositeItemFilter(ItemFilter... filters)
ItemFilters.public void setFilters(List<ItemFilter> filters)
public void addFilter(ItemFilter filter)
ItemFilter to the filter list, creating the list if necessary.public boolean removeFilter(ItemFilter filter)
ItemFilter from the filter list, only if the list is not null.public boolean runBeforeProcessing()
runBeforeProcessing in interface ItemFilterpublic boolean runAfterProcessing()
runAfterProcessing in interface ItemFilterpublic boolean accepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing)
runningBeforeProcessing is true, calls all filters that need to be run before processing. If
it is false, calls all filters that need to be run after processing. Filters in the chain are called until
one of them rejects the item.accepts in interface ItemFilteritem - the item to accept or rejectacceptedItems - the list of the currently accepted itemsrejectedItems - the list of the currently rejected itemsrunningBeforeProcessing - if the filter is running before processing (true) or after processing (false)Copyright © 2018 CrafterCMS. All rights reserved.