import org.apache.commons.lang3.builder.ToStringBuilder;
/*
- * The purpose of this class is to encapsulate the possible responses from Valet in to one generic class
- * that the vnf adapter can more easily utilize. This will ensure we get an object back. Any status
- * code other than 200 will be treated as a failure. We may still get a 200 back - but the
- * ValetStatus.status is "failed" - which will also be treated as a failure. The T class is
- * expected to be one of the Valet*Response pojos.
+ * The purpose of this class is to encapsulate the possible responses from Valet in to one generic class that the vnf
+ * adapter can more easily utilize. This will ensure we get an object back. Any status code other than 200 will be
+ * treated as a failure. We may still get a 200 back - but the ValetStatus.status is "failed" - which will also be
+ * treated as a failure. The T class is expected to be one of the Valet*Response pojos.
*/
public class GenericValetResponse<T> {
- private int statusCode;
- private String errorMessage;
- private T returnObject;
-
+ private int statusCode;
+ private String errorMessage;
+ private T returnObject;
+
+
+ public GenericValetResponse(int statusCode, String errorMessage, T obj) {
+ super();
+ this.statusCode = statusCode;
+ this.errorMessage = errorMessage;
+ this.returnObject = obj;
+ }
+
+ public GenericValetResponse() {
+ this(-1, "not set", null);
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
+ .append("returnObject", returnObject).toString();
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public String getErrorMessage() {
+ return this.errorMessage;
+ }
+
+ public void setStatusCode(int statusCode) {
+ this.statusCode = statusCode;
+ }
+
+ public int getStatusCode() {
+ return this.statusCode;
+ }
+
+ public void setReturnObject(T obj) {
+ this.returnObject = obj;
+ }
+
+ public T getReturnObject() {
+ return this.returnObject;
+ }
- public GenericValetResponse(int statusCode, String errorMessage, T obj) {
- super();
- this.statusCode = statusCode;
- this.errorMessage = errorMessage;
- this.returnObject = obj;
- }
- public GenericValetResponse() {
- this(-1, "not set", null);
- }
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
- .append("returnObject", returnObject).toString();
- }
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
- public String getErrorMessage() {
- return this.errorMessage;
- }
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
- public int getStatusCode() {
- return this.statusCode;
- }
- public void setReturnObject(T obj) {
- this.returnObject = obj;
- }
- public T getReturnObject() {
- return this.returnObject;
- }
-
}