Commit | Line | Data |
---|---|---|
1 | package jrw; | |
2 | ||
3 | import java.util.*; | |
4 | import java.util.function.*; | |
5 | ||
6 | public abstract class JagiWrapper implements Handler, Function<Map<Object, Object>, Map<Object, Object>> { | |
7 | public Map<Object, Object> apply(Map<Object, Object> env) { | |
8 | return(Dispatch.handle(this, new Request(env))); | |
9 | } | |
10 | ||
11 | public static JagiWrapper of(Handler handler) { | |
12 | return(new JagiWrapper() { | |
13 | public Map<Object, Object> handle(Request req) { | |
14 | return(handler.handle(req)); | |
15 | } | |
16 | }); | |
17 | } | |
18 | } |