Skip to content

Commit 9062422

Browse files
committed
Add setters to JSON RPC classes
When appropriate. Some properties are accessed with reflection and making them private makes those reflection calls fail. References #429 (cherry picked from commit 0168ce9)
1 parent e730cd8 commit 9062422

File tree

4 files changed

+52
-5
lines changed

4 files changed

+52
-5
lines changed

src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,25 @@ public class JsonRpcException extends Exception {
2727
/**
2828
* Usually the constant string, "JSONRPCError"
2929
*/
30-
private String name;
30+
private final String name;
3131
/**
3232
* Error code
3333
*/
34-
private int code;
34+
private final int code;
3535
/**
3636
* Error message
3737
*/
38-
private String message;
38+
private final String message;
3939
/**
4040
* Error detail object - may not always be present or meaningful
4141
*/
42-
private Object error;
42+
private final Object error;
4343

4444
public JsonRpcException() {
45-
// no work needed in default no-arg constructor
45+
this.name = null;
46+
this.code = -1;
47+
this.message = null;
48+
this.error = null;
4649
}
4750

4851
public JsonRpcException(String detailMessage, String name, int code, String message, Object error) {

src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,12 @@ public String getName() {
6565
public String getType() {
6666
return type;
6767
}
68+
69+
public void setName(String name) {
70+
this.name = name;
71+
}
72+
73+
public void setType(String type) {
74+
this.type = type;
75+
}
6876
}

src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,20 @@ public String getHelp() {
155155
public boolean isIdempotent() {
156156
return idempotent;
157157
}
158+
159+
public void setName(String name) {
160+
this.name = name;
161+
}
162+
163+
public void setSummary(String summary) {
164+
this.summary = summary;
165+
}
166+
167+
public void setHelp(String help) {
168+
this.help = help;
169+
}
170+
171+
public void setIdempotent(boolean idempotent) {
172+
this.idempotent = idempotent;
173+
}
158174
}

src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,24 @@ public String getSummary() {
111111
public String getHelp() {
112112
return help;
113113
}
114+
115+
public void setName(String name) {
116+
this.name = name;
117+
}
118+
119+
public void setId(String id) {
120+
this.id = id;
121+
}
122+
123+
public void setVersion(String version) {
124+
this.version = version;
125+
}
126+
127+
public void setSummary(String summary) {
128+
this.summary = summary;
129+
}
130+
131+
public void setHelp(String help) {
132+
this.help = help;
133+
}
114134
}

0 commit comments

Comments
 (0)