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

com.jelastic.api.system.persistence.SoftNodeGroupProperty Maven / Gradle / Ivy

The newest version!
/*Server class MD5: 93043bdd17c1e543da76784404369b09*/
package com.jelastic.api.system.persistence;

import com.jelastic.api.development.response.interfaces.ArrayItem;
import org.json.JSONException;
import org.json.JSONObject;

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

    public static final String ID = "id";

    public static final String NAME = "name";

    public static final String VALUE = "value";

    public static final String TYPE = "type";

    private String name;

    private String value;

    private SoftNodeGroupPropertyType type;

    public SoftNodeGroupProperty() {
    }

    public SoftNodeGroupProperty(String name, String value, SoftNodeGroupPropertyType type) {
        this.name = name;
        this.value = value;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public SoftNodeGroupPropertyType getType() {
        return type;
    }

    public void setType(SoftNodeGroupPropertyType type) {
        this.type = type;
    }

    @Override
    public JSONObject _toJSON() throws JSONException {
        return toJSON(false);
    }

    public JSONObject toJSON(boolean isExport) throws JSONException {
        JSONObject json = new JSONObject();
        json.put(NAME, name);
        json.put(VALUE, value);
        if (isExport) {
            json.put(TYPE, type);
        }
        return json;
    }

    @Override
    public SoftNodeGroupProperty _fromJSON(JSONObject json) throws JSONException {
        if (json.has(NAME)) {
            this.name = json.getString(NAME);
        }
        if (json.has(VALUE)) {
            this.value = json.getString(VALUE);
        }
        if (json.has(TYPE)) {
            this.type = SoftNodeGroupPropertyType.valueOf(SoftNodeGroupPropertyType.class, json.getString(TYPE).toUpperCase());
        } else {
            this.type = SoftNodeGroupPropertyType.STRING;
        }
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy