com.jelastic.api.environment.response.NodeGroupResponse Maven / Gradle / Ivy
The newest version!
/*Server class MD5: 5009906eafc070ba24b0078760669b4a*/
package com.jelastic.api.environment.response;
import com.jelastic.api.Response;
import com.jelastic.api.system.persistence.SoftNodeGroup;
import org.json.JSONException;
import org.json.JSONObject;
/**
* @name Jelastic API Client
* @version 8.11.2
* @copyright Jelastic, Inc.
*/
public class NodeGroupResponse extends Response {
public static final String NODE_GROUP = "nodeGroup";
private SoftNodeGroup nodeGroup;
public NodeGroupResponse(SoftNodeGroup nodeGroup) {
super(OK);
this.nodeGroup = nodeGroup;
}
public NodeGroupResponse(Response response) {
super(response.getResult(), response.getError());
}
public NodeGroupResponse() {
super(OK);
}
public NodeGroupResponse(int result, String error) {
super(result, error);
}
public SoftNodeGroup getNodeGroup() {
return nodeGroup;
}
public void setNodeGroup(SoftNodeGroup nodeGroup) {
this.nodeGroup = nodeGroup;
}
@Override
public JSONObject toJSON() {
JSONObject json = super.toJSON();
if (nodeGroup != null) {
try {
json.put(NODE_GROUP, nodeGroup._toJSON());
} catch (JSONException e) {
e.printStackTrace();
}
}
return json;
}
@Override
public NodeGroupResponse fromJSON(JSONObject json) {
super.fromJSON(json);
if (json.has(NODE_GROUP)) {
try {
this.nodeGroup = new SoftNodeGroup()._fromJSON(json.getJSONObject(NODE_GROUP));
} catch (JSONException e) {
e.printStackTrace();
}
}
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy