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.api.domain.BasicVotes;
20 import org.codehaus.jettison.json.JSONException;
21 import org.codehaus.jettison.json.JSONObject;
22
23 import java.net.URI;
24
25
26
27
28 public class BasicVotesJsonParser implements JsonObjectParser<BasicVotes> {
29 @Override
30 public BasicVotes parse(JSONObject json) throws JSONException {
31 final URI self = JsonParseUtil.getSelfUri(json);
32 final int voteCount = json.getInt("votes");
33 final boolean hasVoted = json.getBoolean("hasVoted");
34 return new BasicVotes(self, voteCount, hasVoted);
35 }
36 }