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