1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.internal.json;
18
19 import com.atlassian.jira.rest.client.domain.BasicComponent;
20 import org.codehaus.jettison.json.JSONException;
21 import org.codehaus.jettison.json.JSONObject;
22
23 import java.net.URI;
24
25 public class BasicComponentJsonParser implements JsonParser<BasicComponent> {
26
27 @Override
28 public BasicComponent parse(JSONObject json) throws JSONException {
29 return parseBasicComponent(json);
30 }
31
32 static BasicComponent parseBasicComponent(JSONObject json) throws JSONException {
33 final URI selfUri = JsonParseUtil.getSelfUri(json);
34 final String name = json.getString("name");
35 final String description = JsonParseUtil.getOptionalString(json, "description");
36 return new BasicComponent(selfUri, name, description);
37 }
38
39
40 }