1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.webscripts;
20
21 import java.util.Collections;
22 import java.util.Map;
23
24 import org.apache.commons.collections.map.UnmodifiableMap;
25
26
27
28
29
30
31
32
33
34 public final class Match
35 {
36 final private String templatePath;
37 final private Map<String, String> templateVars;
38 final private String matchPath;
39 final private WebScript script;
40 final private Kind kind;
41
42
43
44
45 public enum Kind
46 {
47
48 URI,
49
50 FULL
51 };
52
53
54
55
56
57
58
59 public Match(String templatePath, Map<String, String> templateVars, String matchPath, WebScript script)
60 {
61 this.kind = Kind.FULL;
62 this.templatePath = templatePath;
63 this.templateVars = Collections.unmodifiableMap(templateVars);
64 this.matchPath = matchPath;
65 this.script = script;
66 }
67
68
69
70
71
72
73 public Match(String templatePath, Map<String, String> templateVars, String matchPath)
74 {
75 this.kind = Kind.URI;
76 this.templatePath = templatePath;
77 this.templateVars = Collections.unmodifiableMap(templateVars);
78 this.matchPath = matchPath;
79 this.script = null;
80 }
81
82
83
84
85 public Kind getKind()
86 {
87 return this.kind;
88 }
89
90
91
92
93
94
95 public String getTemplate()
96 {
97 return templatePath;
98 }
99
100
101
102
103
104
105 public Map<String, String> getTemplateVars()
106 {
107 return templateVars;
108 }
109
110
111
112
113
114
115
116 public String getPath()
117 {
118 return matchPath;
119 }
120
121
122
123
124
125
126 public WebScript getWebScript()
127 {
128 return script;
129 }
130
131 @Override
132 public String toString()
133 {
134 return templatePath;
135 }
136 }