Project

General

Profile

1
package eu.dnetlib.repo.manager.utils;
2

    
3
import com.google.gson.JsonElement;
4
import com.google.gson.JsonObject;
5

    
6
public class JsonUtils {
7

    
8
    private JsonUtils() {
9
    }
10

    
11
    public JsonObject createResponse(JsonElement response) {
12
        JsonObject json = new JsonObject();
13
        json.add("response", response);
14
        return json;
15
    }
16

    
17
    public static JsonObject createResponse(String response) {
18
        JsonObject json = new JsonObject();
19
        json.addProperty("response", response);
20
        return json;
21
    }
22

    
23
    public JsonObject createResponse(Number response) {
24
        JsonObject json = new JsonObject();
25
        json.addProperty("response", response);
26
        return json;
27
    }
28

    
29
    public static JsonObject createResponse(Boolean response) {
30
        JsonObject json = new JsonObject();
31
        json.addProperty("response", response);
32
        return json;
33
    }
34

    
35
    public static JsonObject createResponse(Character response) {
36
        JsonObject json = new JsonObject();
37
        json.addProperty("response", response);
38
        return json;
39
    }
40
}
(5-5/6)