}
public class SubstitutionMapping {
- private String nodeType;
+ private String node_type;
private JsonObject requirements;
private JsonObject capabilities;
- private JsonObject properties;
-
- public String getNodeType() {
- return nodeType;
+
+ public String getNode_type() {
+ return node_type;
}
- public void setNodeType(String nodeType) {
- this.nodeType = nodeType;
+ public void setNode_type(String node_type) {
+ this.node_type = node_type;
}
public JsonObject getRequirements() {
}
private Map<String, String[]> jsonObjects2Requirements(JsonObject requirements) {
+ if (requirements == null) {
+ return new HashMap<String, String[]>();
+ }
+
Map<String, String[]> ret = new HashMap<String, String[]>();
-
Iterator<Entry<String, JsonElement>> iterator = requirements.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, JsonElement> next = iterator.next();
}
private Map<String, String[]> jsonObject2Capabilities(JsonObject capabilities) {
+ if (capabilities == null) {
+ return new HashMap<String, String[]>();
+ }
+
Map<String, String[]> ret = new HashMap<String, String[]>();
-
Iterator<Entry<String, JsonElement>> iterator = capabilities.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, JsonElement> next = iterator.next();
return ret;
}
-
- public JsonObject getProperties() {
- return properties;
- }
-
- public void setProperties(JsonObject properties) {
- this.properties = properties;
- }
-
- public Map<String, Object> getPropertyList() {
- return jsonObject2Properties(properties);
- }
-
- private Map<String, Object> jsonObject2Properties(JsonObject properties) {
- Map<String, Object> ret = new HashMap<>();
- Iterator<Entry<String, JsonElement>> iterator = properties.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry<String, JsonElement> next = iterator.next();
- ret.put(next.getKey(), ToolUtil.getAsString(next.getValue()));
- }
- return ret;
- }
}
}