Rules Decorator that returns default rules when no matches are returned by the wrapped implementation.
This allows default Rule instances to be added to any existing Rules implementation. These default Rule instances will be returned for any match for which the wrapped implementation does not return any matches.
For example,
Rule alpha; ... WithDefaultsRulesWrapper rules = new WithDefaultsRulesWrapper(new BaseRules()); rules.addDefault(alpha); ... digester.setRules(rules); ...when a pattern does not match any other rule, then rule alpha will be called.
WithDefaultsRulesWrapper follows the Decorator pattern.
| |
| |