1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.seasar.cubby.routing.impl;
18
19 import java.lang.reflect.Method;
20 import java.util.List;
21 import java.util.regex.Pattern;
22
23 import org.seasar.cubby.action.RequestMethod;
24 import org.seasar.cubby.internal.util.StringUtils;
25 import org.seasar.cubby.routing.Routing;
26
27
28
29
30
31
32 class RoutingImpl implements Routing {
33
34
35 private final Class<?> actionClass;
36
37
38 private final Method actionMethod;
39
40
41 private final String actionPath;
42
43
44 private final List<String> uriParameterNames;
45
46
47 private final Pattern pattern;
48
49
50 private final RequestMethod requestMethod;
51
52
53 private final String onSubmit;
54
55
56 private final int priority;
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 RoutingImpl(final Class<?> actionClass, final Method actionMethod,
80 final String actionPath, final List<String> uriParameterNames,
81 final Pattern pattern, final RequestMethod requestMethod,
82 final String onSubmit, final int priority) {
83 this.actionClass = actionClass;
84 this.actionMethod = actionMethod;
85 this.actionPath = actionPath;
86 this.uriParameterNames = uriParameterNames;
87 this.pattern = pattern;
88 this.requestMethod = requestMethod;
89 this.onSubmit = onSubmit;
90 this.priority = priority;
91 }
92
93
94
95
96 public Class<?> getActionClass() {
97 return actionClass;
98 }
99
100
101
102
103 public Method getActionMethod() {
104 return actionMethod;
105 }
106
107
108
109
110 public String getActionPath() {
111 return actionPath;
112 }
113
114
115
116
117 public List<String> getUriParameterNames() {
118 return uriParameterNames;
119 }
120
121
122
123
124 public Pattern getPattern() {
125 return pattern;
126 }
127
128
129
130
131 public RequestMethod getRequestMethod() {
132 return requestMethod;
133 }
134
135
136
137
138 public String getOnSubmit() {
139 return onSubmit;
140 }
141
142
143
144
145 public int getPriority() {
146 return this.priority;
147 }
148
149
150
151
152 public boolean isAcceptable(final String requestMethod) {
153 return StringUtils.equalsIgnoreCase(this.requestMethod.name(),
154 requestMethod);
155 }
156
157
158
159
160
161
162 @Override
163 public String toString() {
164 return new StringBuilder().append("[regex=").append(this.pattern)
165 .append(",actionMethod=").append(this.actionMethod).append(
166 ",uriParameterNames=").append(this.uriParameterNames)
167 .append(",requestMethod=").append(this.requestMethod).append(
168 ",onSubmit=").append(onSubmit).append(",priority=")
169 .append(this.priority).append(",auto=").append("]").toString();
170 }
171 }