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

com.jelastic.api.data.response.ObjectsCountResponse Maven / Gradle / Ivy

The newest version!
/*Server class MD5: 7049b02ba9525ae5abe6463c6e1a3510*/
package com.jelastic.api.data.response;

import com.jelastic.api.Response;
import org.json.JSONException;
import org.json.JSONObject;

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

    private long count = -1;

    public ObjectsCountResponse(long count) {
        super(Response.OK);
        this.count = count;
    }

    public ObjectsCountResponse() {
        super(Response.OK);
    }

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

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        this.count = count;
    }

    @Override
    public JSONObject toJSON() {
        JSONObject json = super.toJSON();
        try {
            if (count != -1) {
                json.put("count", count);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            try {
                json.put("result", Response.ERROR_UNKNOWN).put("error", ex.toString());
            } catch (JSONException exc) {
            }
        }
        return json;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy