|
1 | 1 | package org.javawebstack.httpserver; |
2 | 2 |
|
3 | 3 | import com.google.gson.JsonElement; |
4 | | -import org.javawebstack.graph.GraphElement; |
5 | | -import org.javawebstack.graph.GraphNull; |
| 4 | +import org.javawebstack.abstractdata.AbstractElement; |
| 5 | +import org.javawebstack.abstractdata.AbstractNull; |
6 | 6 | import org.javawebstack.httpserver.helper.HttpMethod; |
7 | 7 | import org.javawebstack.httpserver.helper.MimeType; |
8 | 8 | import org.javawebstack.validator.ValidationException; |
@@ -49,22 +49,22 @@ public <T> T body(Class<T> clazz){ |
49 | 49 | MimeType type = MimeType.byMimeType(getContentType()); |
50 | 50 | if(type == null) |
51 | 51 | type = MimeType.JSON; |
52 | | - GraphElement request = GraphNull.INSTANCE; |
| 52 | + AbstractElement request = AbstractNull.INSTANCE; |
53 | 53 | switch (type){ |
54 | 54 | case JSON: |
55 | | - request = GraphElement.fromJson(body); |
| 55 | + request = AbstractElement.fromJson(body); |
56 | 56 | break; |
57 | 57 | case YAML: |
58 | | - request = GraphElement.fromYaml(body, !(clazz.isArray() || Collection.class.isAssignableFrom(clazz))); |
| 58 | + request = AbstractElement.fromYaml(body, !(clazz.isArray() || Collection.class.isAssignableFrom(clazz))); |
59 | 59 | break; |
60 | 60 | case X_WWW_FORM_URLENCODED: |
61 | | - request = GraphElement.fromFormData(body); |
| 61 | + request = AbstractElement.fromFormData(body); |
62 | 62 | break; |
63 | 63 | } |
64 | 64 | ValidationResult result = Validator.getValidator(clazz).validate(request); |
65 | 65 | if(!result.isValid()) |
66 | 66 | throw new ValidationException(result); |
67 | | - return server.getGraphMapper().fromGraph(request, clazz); |
| 67 | + return server.getAbstractMapper().fromAbstract(request, clazz); |
68 | 68 | } |
69 | 69 |
|
70 | 70 | public HTTPServer getServer() { |
@@ -193,12 +193,12 @@ public String bearerAuth(){ |
193 | 193 | return auth.substring(7); |
194 | 194 | } |
195 | 195 | public <T> T getBodyPath(String path, Class<T> clazz){ |
196 | | - return server.getGraphMapper().fromGraph(getBodyPathElement(path), clazz); |
| 196 | + return server.getAbstractMapper().fromAbstract(getBodyPathElement(path), clazz); |
197 | 197 | } |
198 | | - public GraphElement getBodyPathElement(String path){ |
199 | | - return getPathElement(body(GraphElement.class), path); |
| 198 | + public AbstractElement getBodyPathElement(String path){ |
| 199 | + return getPathElement(body(AbstractElement.class), path); |
200 | 200 | } |
201 | | - protected static GraphElement getPathElement(GraphElement source, String path){ |
| 201 | + protected static AbstractElement getPathElement(AbstractElement source, String path){ |
202 | 202 | if(source == null || path == null || path.length() == 0) |
203 | 203 | return source; |
204 | 204 | if(!path.contains(".")){ |
|
0 commit comments