forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParamSource.java
More file actions
63 lines (51 loc) · 1.3 KB
/
ParamSource.java
File metadata and controls
63 lines (51 loc) · 1.3 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* 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;
/**
* List of possible parameter sources supported by {@link Context#lookup(String, ParamSource...)}.
*
* @see io.jooby.annotations.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),
/**
* Source equivalent to {@link Context#multipart(String)}.
*/
MULTIPART(Context::multipart);
final BiFunction<Context, String, Value> provider;
ParamSource(BiFunction<Context, String, Value> provider) {
this.provider = provider;
}
}