@Override public void toJson(Writer writer) throws IOException { JsonArray scripts = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { scripts.append(scriptResource.toJsonValue()); } toJson(writer, "addPageResources", Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), cssSource(), scripts); }
@Override public void toJson(Writer writer) throws IOException { JsonArray scripts = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { scripts.append(scriptResource.toJsonValue()); } toJson(writer, "addPageResources", Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), cssSource(), scripts); }
@Override public void toJson(Writer writer) throws IOException { JsonArray strArray = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { strArray.append(scriptResource.toJsonValue()); } toJson(writer, "addPortletType", portletType(), displayName(), Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), strArray, isInstantiable()); } }
@Override public void toJson(Writer writer) throws IOException { JsonArray strArray = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { strArray.append(scriptResource.toJsonValue()); } toJson(writer, "addPortletType", portletType(), displayName(), Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), strArray, isInstantiable()); } }
/** * Provides the JSON representation of the information. * * @return the json object */ public JsonObject toJsonValue() { JsonObject obj = JsonObject.create(); if (scriptUri != null) { obj.setField("uri", scriptUri.toString()); } if (scriptSource != null) { obj.setField("source", scriptSource); } JsonArray strArray = JsonArray.create(); for (String req : requires) { strArray.append(req); } obj.setField("requires", strArray); strArray = JsonArray.create(); for (String prov : provides) { strArray.append(prov); } obj.setField("provides", strArray); return obj; } }