1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.json.binding.biojs; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Collection; |
25 |
|
import java.util.Iterator; |
26 |
|
import java.util.Objects; |
27 |
|
|
28 |
|
import org.json.simple.JSONArray; |
29 |
|
import org.json.simple.JSONObject; |
30 |
|
import org.json.simple.parser.JSONParser; |
31 |
|
import org.json.simple.parser.ParseException; |
32 |
|
|
|
|
| 69.7% |
Uncovered Elements: 10 (33) |
Complexity: 11 |
Complexity Density: 0.5 |
|
33 |
|
public class BioJSRepositoryPojo |
34 |
|
{ |
35 |
|
|
36 |
|
private String description; |
37 |
|
|
38 |
|
private String latestReleaseVersion; |
39 |
|
|
40 |
|
private Collection<BioJSReleasePojo> releases = new ArrayList<BioJSReleasePojo>(); |
41 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
42 |
0 |
public BioJSRepositoryPojo()... |
43 |
|
{ |
44 |
|
} |
45 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
46 |
12 |
public BioJSRepositoryPojo(String jsonString)... |
47 |
|
{ |
48 |
12 |
try |
49 |
|
{ |
50 |
12 |
parse(jsonString); |
51 |
|
} catch (ParseException e) |
52 |
|
{ |
53 |
0 |
e.printStackTrace(); |
54 |
|
} |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
|
57 |
12 |
@SuppressWarnings("unchecked")... |
58 |
|
private void parse(String jsonString) throws ParseException |
59 |
|
{ |
60 |
12 |
Objects.requireNonNull(jsonString, |
61 |
|
"Supplied jsonString must not be null"); |
62 |
12 |
JSONParser jsonParser = new JSONParser(); |
63 |
12 |
JSONObject JsonObj = (JSONObject) jsonParser.parse(jsonString); |
64 |
12 |
this.description = (String) JsonObj.get("description"); |
65 |
12 |
this.latestReleaseVersion = (String) JsonObj |
66 |
|
.get("latestReleaseVersion"); |
67 |
|
|
68 |
12 |
JSONArray repositoriesJsonArray = (JSONArray) JsonObj.get("releases"); |
69 |
12 |
for (Iterator<JSONObject> repoIter = repositoriesJsonArray |
70 |
48 |
.iterator(); repoIter.hasNext();) |
71 |
|
{ |
72 |
36 |
JSONObject repoObj = repoIter.next(); |
73 |
36 |
BioJSReleasePojo repo = new BioJSReleasePojo(); |
74 |
36 |
repo.setType((String) repoObj.get("type")); |
75 |
36 |
repo.setUrl((String) repoObj.get("url")); |
76 |
36 |
repo.setVersion((String) repoObj.get("version")); |
77 |
36 |
this.getReleases().add(repo); |
78 |
|
} |
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0 |
public String getDescription()... |
82 |
|
{ |
83 |
0 |
return description; |
84 |
|
} |
85 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
0 |
public void setDescription(String description)... |
87 |
|
{ |
88 |
0 |
this.description = description; |
89 |
|
} |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
36 |
public String getLatestReleaseVersion()... |
92 |
|
{ |
93 |
36 |
return latestReleaseVersion; |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0 |
public void setLatestReleaseVersion(String latestReleaseVersion)... |
97 |
|
{ |
98 |
0 |
this.latestReleaseVersion = latestReleaseVersion; |
99 |
|
} |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
48 |
public Collection<BioJSReleasePojo> getReleases()... |
102 |
|
{ |
103 |
48 |
return releases; |
104 |
|
} |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0 |
public void setReleases(Collection<BioJSReleasePojo> releases)... |
107 |
|
{ |
108 |
0 |
this.releases = releases; |
109 |
|
} |
110 |
|
|
111 |
|
} |