@Override public ConfigurationRuleBuilder perform(Operation operation) { for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { operation = interceptor.perform(operation); } rule.perform(operation); return this; }
@Override public ConfigurationRuleBuilder when(Condition condition) { for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { condition = interceptor.when(condition); } rule.when(condition); return this; }
@Override public ConfigurationRuleBuilder withId(String id) { for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { id = interceptor.withId(id); } rule.withId(id); return this; }
@Override public ConfigurationRuleBuilder withPriority(int priority) { for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { priority = interceptor.withPriority(priority); } rule.withPriority(priority); return this; }
@Override public ConfigurationRuleBuilder otherwise(Operation operation) { for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { operation = interceptor.otherwise(operation); } wrapped.addOtherwiseRule(rule).when(Not.any(rule)).perform(operation); return this; }
@Override public ConfigurationRuleBuilderWhen when(Condition condition, Condition... conditions) { List<Condition> list = new LinkedList<Condition>(); list.add(condition); list.addAll(Arrays.asList(conditions)); for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { list = interceptor.when(list); } rule.when(And.all(list.toArray(new Condition[list.size()]))); return this; }
@Override public ConfigurationRuleBuilderPerform perform(Operation operation, Operation... operations) { List<Operation> list = new LinkedList<Operation>(); list.add(operation); list.addAll(Arrays.asList(operations)); for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { list = interceptor.perform(list); } rule.perform(Perform.all(list.toArray(new Operation[list.size()]))); return this; }
@Override public ConfigurationRuleBuilderOtherwise otherwise(Operation operation, Operation... operations) { List<Operation> list = new LinkedList<Operation>(); list.add(operation); list.addAll(Arrays.asList(operations)); for (ConfigurationRuleBuilderInterceptor interceptor : interceptors) { list = interceptor.otherwise(list); } wrapped .addOtherwiseRule(rule) .when(Not.any(rule)) .perform(Perform.all(list.toArray(new Operation[list.size()]))); return this; }