Search in sources :

Example 11 with ModelView

use of org.btrplace.model.view.ModelView in project scheduler by btrplace.

the class ModelConverter method toJSON.

@Override
public JSONObject toJSON(Model i) throws JSONConverterException {
    JSONArray rcs = new JSONArray();
    for (ModelView v : i.getViews()) {
        rcs.add(viewsConverter.toJSON(v));
    }
    JSONObject o = new JSONObject();
    o.put(MAPPING_LABEL, toJSON(i.getMapping()));
    o.put(ATTRS_LABEL, AttributesConverter.toJSON(i.getAttributes()));
    o.put(VIEWS_LABEL, rcs);
    return o;
}
Also used : JSONObject(net.minidev.json.JSONObject) ModelView(org.btrplace.model.view.ModelView) JSONArray(net.minidev.json.JSONArray)

Aggregations

ModelView (org.btrplace.model.view.ModelView)11 Test (org.testng.annotations.Test)6 HashMap (java.util.HashMap)1 Map (java.util.Map)1 StringJoiner (java.util.StringJoiner)1 JSONArray (net.minidev.json.JSONArray)1 JSONObject (net.minidev.json.JSONObject)1