Skip to content

Commit 9feaa72

Browse files
committed
Made attributes private
1 parent ffce870 commit 9feaa72

16 files changed

Lines changed: 104 additions & 71 deletions

ReleaseNotes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242

4343
### API Changes
4444

45+
The attributes of the following classes have been made
46+
private. They are only accessible via getters/setters.
47+
48+
`MavenArtifact`, `ComputerWithDetails`, `Executable`, `FolderJob`,
49+
`JobWithDetails`, `MavenJobWithDetails`, `MavenModule`, `MavenModuleRecord`,
50+
`PluginManager`
51+
4552
[Fixed issue 174][issue-174]
4653

4754
jenkins.getComputerSet().getComputer() produced an error.

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Artifact.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
public class Artifact extends BaseModel {
1010

11-
String displayPath;
12-
String fileName;
13-
String relativePath;
11+
private String displayPath;
12+
private String fileName;
13+
private String relativePath;
1414

1515
public String getDisplayPath() {
1616
return displayPath;

jenkins-client/src/main/java/com/offbytwo/jenkins/model/BaseModel.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88

99
import com.offbytwo.jenkins.client.JenkinsHttpClient;
1010

11+
/**
12+
* The base model.
13+
*
14+
*/
1115
public class BaseModel {
1216

13-
JenkinsHttpClient client;
17+
//TODO: We should make this private
18+
protected JenkinsHttpClient client;
1419

1520
public JenkinsHttpClient getClient() {
1621
return client;

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Computer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
import com.google.common.net.UrlEscapers;
1313

14+
/**
15+
* @author Kelly Plummer
16+
*
17+
*/
1418
public class Computer extends BaseModel {
1519

1620
private String displayName;

jenkins-client/src/main/java/com/offbytwo/jenkins/model/ComputerSet.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2013 Cosmin Stejerean, Karl Heinz Marbaise, and contributors.
3+
*
4+
* Distributed under the MIT license: http://opensource.org/licenses/MIT
5+
*/
6+
17
package com.offbytwo.jenkins.model;
28

39
import java.util.List;

jenkins-client/src/main/java/com/offbytwo/jenkins/model/ComputerWithDetails.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616

1717
public class ComputerWithDetails extends Computer {
1818

19-
String displayName;
20-
List actions;
21-
List<Executor> executors;
22-
Boolean idle;
23-
Boolean jnlp;
24-
Boolean launchSupported;
25-
Boolean manualLaunchAllowed;
26-
Map monitorData;
27-
Integer numExecutors;
28-
Boolean offline;
29-
OfflineCause offlineCause;
30-
String offlineCauseReason;
31-
List oneOffExecutors;
32-
Boolean temporarilyOffline;
19+
private String displayName;
20+
private List actions; //TODO: What kind of List?
21+
private List<Executor> executors;
22+
private Boolean idle;
23+
private Boolean jnlp;
24+
private Boolean launchSupported;
25+
private Boolean manualLaunchAllowed;
26+
private Map monitorData; //TODO: What kind of map?
27+
private Integer numExecutors;
28+
private Boolean offline;
29+
private OfflineCause offlineCause;
30+
private String offlineCauseReason;
31+
private List oneOffExecutors; //TODO: What kind of List?
32+
private Boolean temporarilyOffline;
3333

3434
public ComputerWithDetails()
3535
{

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Executable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.offbytwo.jenkins.model;
22

33
public class Executable {
4-
Long number;
4+
private Long number;
55

6-
String url;
6+
private String url;
77

88
public Long getNumber() {
99
return number;

jenkins-client/src/main/java/com/offbytwo/jenkins/model/FolderJob.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
public class FolderJob extends Job {
1313

14-
String displayName;
15-
List<Job> jobs;
14+
private String displayName;
15+
private List<Job> jobs;
1616

1717
public FolderJob() {
1818
}

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Job.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public void build() throws IOException {
7171
client.post(url + "build");
7272
}
7373

74+
/**
75+
* Trigger a build with crumbFlag.
76+
* @param crumbFlag true or false.
77+
* @throws IOException in case of an error.
78+
*/
7479
public void build(boolean crumbFlag) throws IOException {
7580
client.post(url + "build", crumbFlag);
7681
}

jenkins-client/src/main/java/com/offbytwo/jenkins/model/JobWithDetails.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,39 @@
2424

2525
public class JobWithDetails extends Job {
2626

27-
String description;
27+
private String description;
2828

29-
String displayName;
29+
private String displayName;
3030

31-
boolean buildable;
31+
private boolean buildable;
3232

33-
List<Build> builds;
33+
private List<Build> builds;
3434

35-
Build firstBuild;
35+
private Build firstBuild;
3636

37-
Build lastBuild;
37+
private Build lastBuild;
3838

39-
Build lastCompletedBuild;
39+
private Build lastCompletedBuild;
4040

41-
Build lastFailedBuild;
41+
private Build lastFailedBuild;
4242

43-
Build lastStableBuild;
43+
private Build lastStableBuild;
4444

45-
Build lastSuccessfulBuild;
45+
private Build lastSuccessfulBuild;
4646

47-
Build lastUnstableBuild;
47+
private Build lastUnstableBuild;
4848

49-
Build lastUnsuccessfulBuild;
49+
private Build lastUnsuccessfulBuild;
5050

51-
int nextBuildNumber;
51+
private int nextBuildNumber;
5252

53-
boolean inQueue;
53+
private boolean inQueue;
5454

55-
QueueItem queueItem;
55+
private QueueItem queueItem;
5656

57-
List<Job> downstreamProjects;
57+
private List<Job> downstreamProjects;
5858

59-
List<Job> upstreamProjects;
59+
private List<Job> upstreamProjects;
6060

6161
public String getDescription()
6262
{
@@ -138,7 +138,7 @@ public Build apply(Build from) {
138138
});
139139
}
140140
} catch (HttpResponseException e) {
141-
// TODO: Thinks about a better handline if the job does not exist?
141+
// TODO: Thinks about a better handling if the job does not exist?
142142
if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
143143
// TODO: Check this if this is necessary or a good idea?
144144

@@ -282,7 +282,7 @@ public int getNextBuildNumber() {
282282
/**
283283
* @return the list of downstream projects.
284284
* If no downstream projects exist just return
285-
* an {@link Collections#emptyList()}
285+
* an empty list {@link Collections#emptyList()}.
286286
*/
287287
public List<Job> getDownstreamProjects() {
288288
if (downstreamProjects == null) {
@@ -295,7 +295,7 @@ public List<Job> getDownstreamProjects() {
295295
/**
296296
* @return the list of upstream projects.
297297
* If no upstream projects exist just return
298-
* an {@link Collections#emptyList()}
298+
* an empty list {@link Collections#emptyList()}.
299299
*/
300300
public List<Job> getUpstreamProjects() {
301301
if (upstreamProjects == null) {

0 commit comments

Comments
 (0)