com.jelastic.api.data.po.DockerVolumeFrom Maven / Gradle / Ivy
The newest version!
/*Server class MD5: 691f90da6d844f5b821f7934b6520013*/
package com.jelastic.api.data.po;
import com.jelastic.api.system.persistence.FilePermissions;
import com.jelastic.api.system.persistence.SoftwareNode;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @name Jelastic API Client
* @version 8.11.2
* @copyright Jelastic, Inc.
*/
public class DockerVolumeFrom {
public static final String SOURCE_NODE_ID = "sourceNodeId";
public static final String READ_ONLY = "readOnly";
public static final String VOLUMES = "volumes";
private int sourceNodeId;
private boolean readOnly;
private List volumes;
private Map volumesMounts = new HashMap<>();
private SoftwareNode softwareNode;
public DockerVolumeFrom() {
}
public DockerVolumeFrom(int sourceNodeId, boolean readOnly) {
this.sourceNodeId = sourceNodeId;
this.readOnly = readOnly;
}
public int getSourceNodeId() {
return sourceNodeId;
}
public void setSourceNodeId(int sourceNodeId) {
this.sourceNodeId = sourceNodeId;
}
public boolean isReadOnly() {
return readOnly;
}
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
public List getVolumes() {
return volumes;
}
public void setVolumes(List volumes) {
this.volumes = volumes;
}
public Map getVolumesMounts() {
return volumesMounts;
}
public void setVolumesMounts(Map volumesMounts) {
this.volumesMounts = volumesMounts;
}
public SoftwareNode getSoftwareNode() {
return softwareNode;
}
public void setSoftwareNode(SoftwareNode softwareNode) {
this.softwareNode = softwareNode;
}
public JSONObject _toJSON() throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put(SOURCE_NODE_ID, sourceNodeId);
jsonObject.put(READ_ONLY, readOnly);
return jsonObject;
}
public DockerVolumeFrom _fromJSON(JSONObject jsonObject) throws JSONException {
if (jsonObject.has(SOURCE_NODE_ID)) {
sourceNodeId = jsonObject.getInt(SOURCE_NODE_ID);
} else {
throw new JSONException("Object format error");
}
if (jsonObject.has(READ_ONLY)) {
readOnly = jsonObject.getBoolean(READ_ONLY);
}
if (jsonObject.has(VOLUMES)) {
volumes = new ArrayList<>();
JSONArray array = jsonObject.getJSONArray(VOLUMES);
for (int i = 0; i < array.length(); i++) {
volumes.add(array.getString(i));
}
}
return this;
}
@Override
public int hashCode() {
return sourceNodeId;
}
@Override
public boolean equals(Object obj) {
return this.sourceNodeId == ((DockerVolumeFrom) obj).sourceNodeId;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy