forked from gaelTorrecillas/odoo-java-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponse.java
More file actions
43 lines (35 loc) · 999 Bytes
/
Copy pathResponse.java
File metadata and controls
43 lines (35 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.odoojava.api;
public class Response {
private final boolean isSuccessful;
private final Exception errorCause;
private final Object responseObject;
private final Object[] responseObjectAsArray;
public Response(final Exception errorCause) {
this.isSuccessful = false;
this.errorCause = errorCause;
this.responseObject = null;
this.responseObjectAsArray = new Object[0];
}
public Response(final Object responseObject) {
this.isSuccessful = true;
this.errorCause = null;
this.responseObject = responseObject;
if (responseObject instanceof Object[]) {
this.responseObjectAsArray = (Object[]) responseObject;
} else {
this.responseObjectAsArray = new Object[] { responseObject };
}
}
public boolean isSuccessful() {
return isSuccessful;
}
public Throwable getErrorCause() {
return errorCause;
}
public Object getResponseObject() {
return responseObject;
}
public Object[] getResponseObjectAsArray() {
return responseObjectAsArray;
}
}