|
8 | 8 | import io.jooby.Context; |
9 | 9 | import io.jooby.Formdata; |
10 | 10 | import io.jooby.Multipart; |
| 11 | +import io.jooby.Session; |
11 | 12 | import io.jooby.apt.Annotations; |
12 | 13 | import io.jooby.internal.apt.asm.ContextParamWriter; |
13 | 14 | import io.jooby.internal.apt.asm.NamedParamWriter; |
@@ -77,7 +78,26 @@ public enum ParamKind { |
77 | 78 | return new ContextParamWriter(); |
78 | 79 | } |
79 | 80 | }, |
| 81 | + SESSION_ATTRIBUTE_PARAM { |
| 82 | + @Override public Set<String> annotations() { |
| 83 | + return Annotations.SESSION_PARAMS; |
| 84 | + } |
80 | 85 |
|
| 86 | + @Override public Method valueObject(ParamDefinition param) throws NoSuchMethodException { |
| 87 | + if (param.isOptional()) { |
| 88 | + return Context.class.getDeclaredMethod("sessionOrNull"); |
| 89 | + } |
| 90 | + return Context.class.getDeclaredMethod("session"); |
| 91 | + } |
| 92 | + |
| 93 | + @Override public Method singleValue(ParamDefinition param) throws NoSuchMethodException { |
| 94 | + return Context.class.getDeclaredMethod("session", String.class); |
| 95 | + } |
| 96 | + |
| 97 | + @Override public ParamWriter newWriter() { |
| 98 | + return new NamedParamWriter(); |
| 99 | + } |
| 100 | + }, |
81 | 101 | QUERY_PARAM { |
82 | 102 | @Override public Set<String> annotations() { |
83 | 103 | return Annotations.QUERY_PARAMS; |
@@ -163,18 +183,7 @@ public enum ParamKind { |
163 | 183 | return new NamedParamWriter(); |
164 | 184 | } |
165 | 185 | }, |
166 | | - SESSION_PARAM { |
167 | | - @Override public Set<String> annotations() { |
168 | | - return Collections.emptySet(); |
169 | | - } |
170 | 186 |
|
171 | | - @Override public Method valueObject(ParamDefinition param) throws NoSuchMethodException { |
172 | | - if (param.isOptional()) { |
173 | | - return Context.class.getDeclaredMethod("sessionOrNull"); |
174 | | - } |
175 | | - return Context.class.getDeclaredMethod("session"); |
176 | | - } |
177 | | - }, |
178 | 187 | ROUTE_PARAM { |
179 | 188 | @Override public Set<String> annotations() { |
180 | 189 | return Collections.emptySet(); |
|
0 commit comments