1 package jalview.json.binding.v1;
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.Iterator;
7 import org.json.simple.JSONArray;
8 import org.json.simple.JSONObject;
9 import org.json.simple.parser.JSONParser;
10 import org.json.simple.parser.ParseException;
12 public class BioJSRepositoryPojo
15 private String description;
17 private String latestReleaseVersion;
19 private Collection<BioJSReleasePojo> releases = new ArrayList<BioJSReleasePojo>();
21 public BioJSRepositoryPojo()
25 public BioJSRepositoryPojo(String jsonString)
30 } catch (ParseException e)
36 @SuppressWarnings("unchecked")
37 private void parse(String jsonString) throws ParseException
39 JSONParser jsonParser = new JSONParser();
40 JSONObject JsonObj = (JSONObject) jsonParser.parse(jsonString);
41 this.description = (String) JsonObj.get("description");
42 this.latestReleaseVersion = (String) JsonObj
43 .get("latestReleaseVersion");
45 JSONArray repositoriesJsonArray = (JSONArray) JsonObj
47 for (Iterator<JSONObject> repoIter = repositoriesJsonArray.iterator(); repoIter
50 JSONObject repoObj = repoIter.next();
51 BioJSReleasePojo repo = new BioJSReleasePojo();
52 repo.setType((String) repoObj.get("type"));
53 repo.setUrl((String) repoObj.get("url"));
54 repo.setVersion((String) repoObj.get("version"));
55 this.getReleases().add(repo);
59 public String getDescription()
64 public void setDescription(String description)
66 this.description = description;
70 public String getLatestReleaseVersion()
72 return latestReleaseVersion;
75 public void setLatestReleaseVersion(String latestReleaseVersion)
77 this.latestReleaseVersion = latestReleaseVersion;
80 public Collection<BioJSReleasePojo> getReleases()
85 public void setReleases(Collection<BioJSReleasePojo> releases)
87 this.releases = releases;