com.ibm.commerce.rules
Interface RuleServiceConfigurationFilter
- public interface RuleServiceConfigurationFilter
A block of code used to as a filter over a collection
of rule service configurations. Clients can use this to determine,
for example, which rule service configurations to remove from a
collection.
As an example, suppose a class maintains a collection of rule
service configurations and wishes to provide a "remove" operation.
It cannot ask clients to iterate over the elements of its collection
and remove the appropriate ones, because this leads to concurrent
modification problems. It may instead provide a method like this.
// Removes all rule service configurations for which the specified
// filter returns true.
public void removeRuleServiceConfigurations(RuleServiceConfigurationFilter aFilter) {
// Prevent other threads from working with this
// collection during iteration.
synchronized(myRuleServiceConfigurations) {
Iterator I = myRuleServiceConfigurations.iterator();
while (I.hasNext()) {
// Should I remove this one?
if (aFilter.accept((RuleServiceConfiguration) I.next()) {
// Use the iterator's remove method, which is
// guaranteed to do the right thing.
I.remove();
}
}
}
}
- See Also:
RulesSystemDataModel
Field Summary |
static java.lang.String |
COPYRIGHT
|
Method Summary |
boolean |
accept(RuleServiceConfiguration each)
Implementors must return true if an action should
be performed on this rule service configuration; false
otherwise. |
COPYRIGHT
public static final java.lang.String COPYRIGHT
accept
public boolean accept(RuleServiceConfiguration each)
- Implementors must return
true
if an action should
be performed on this rule service configuration; false
otherwise.