Register a new Rule instance matching the specified pattern. @param pattern Nesting pattern to be matched for this Rule @param rule Rule instance to be registered
(String pattern, Rule rule)
| 98 | * @param rule Rule instance to be registered |
| 99 | */ |
| 100 | @Override |
| 101 | public void add(String pattern, Rule rule) { |
| 102 | // to help users who accidentally add '/' to the end of their patterns |
| 103 | int patternLength = pattern.length(); |
| 104 | if (patternLength > 1 && pattern.endsWith("/")) { |
| 105 | pattern = pattern.substring(0, patternLength - 1); |
| 106 | } |
| 107 | |
| 108 | cache.computeIfAbsent(pattern, k -> new ArrayList<>()).add(rule); |
| 109 | rules.add(rule); |
| 110 | if (this.digester != null) { |
| 111 | rule.setDigester(this.digester); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | |
| 116 | /** |
nothing calls this directly
no test coverage detected