-
-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathParamSource.java
More file actions
46 lines (34 loc) · 1.17 KB
/
ParamSource.java
File metadata and controls
46 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby;
import java.util.function.BiFunction;
import io.jooby.value.Value;
/**
* List of possible parameter sources supported by {@link Context#lookup(String, ParamSource...)}.
*
* @see io.jooby.annotation.Param
* @see Context#lookup(String, ParamSource...)
*/
public enum ParamSource {
/** Source equivalent to {@link Context#path(String)}. */
PATH(Context::path),
/** Source equivalent to {@link Context#header(String)}. */
HEADER(Context::header),
/** Source equivalent to {@link Context#cookie(String)}. */
COOKIE(Context::cookie),
/** Source equivalent to {@link Context#flash(String)}. */
FLASH(Context::flash),
/** Source equivalent to {@link Context#session(String)}. */
SESSION(Context::session),
/** Source equivalent to {@link Context#query(String)}. */
QUERY(Context::query),
/** Source equivalent to {@link Context#form(String)}. */
FORM(Context::form);
final BiFunction<Context, String, Value> provider;
ParamSource(BiFunction<Context, String, Value> provider) {
this.provider = provider;
}
}