All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jelastic.api.environment.response.SoftwareNodeResponse Maven / Gradle / Ivy

The newest version!
/*Server class MD5: fedc0483023c2ee240e6783e5f3ba786*/
package com.jelastic.api.environment.response;

import com.jelastic.api.Response;
import com.jelastic.api.system.persistence.SoftwareNode;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * @name Jelastic API Client
 * @version 8.11.2
 * @copyright Jelastic, Inc.
 */
public class SoftwareNodeResponse extends Response {

    private SoftwareNode softNode;

    public SoftwareNodeResponse(Response response) {
        super(response.getResult(), response.getError());
    }

    public SoftwareNodeResponse(int result, String error) {
        super(result, error);
    }

    public SoftwareNodeResponse() {
        super(OK);
    }

    public SoftwareNodeResponse(SoftwareNode softNode) {
        super(OK);
        this.softNode = softNode;
    }

    public SoftwareNode getSoftNode() {
        return softNode;
    }

    @Override
    protected JSONObject _toJSON() throws JSONException {
        JSONObject json = super._toJSON();
        if (softNode != null) {
            json.put("node", softNode._toJSON());
        }
        return json;
    }

    @Override
    protected SoftwareNodeResponse _fromJSON(JSONObject json) throws JSONException {
        super._fromJSON(json);
        if (json.has("node")) {
            softNode = new SoftwareNode()._fromJSON(json.getJSONObject("node"));
        }
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy