1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.tonicsystems.jarjar;
18
19 import java.util.*;
20
21 abstract public class PatternElement
22 {
23 private String pattern;
24
25 public void setPattern(String pattern) {
26 this.pattern = pattern;
27 }
28
29 public String getPattern() {
30 return pattern;
31 }
32
33 static List<Wildcard> createWildcards(List<? extends PatternElement> patterns) {
34 List<Wildcard> wildcards = new ArrayList<Wildcard>();
35 for (PatternElement pattern : patterns) {
36 String result = (pattern instanceof Rule) ? ((Rule)pattern).getResult() : "";
37 String expr = pattern.getPattern();
38 if (expr.indexOf('/') >= 0)
39 throw new IllegalArgumentException("Patterns cannot contain slashes");
40 wildcards.add(new Wildcard(expr.replace('.', '/'), result));
41 }
42 return wildcards;
43 }
44 }