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