private JsonElement serializeModules( ProjectConfig moduleConfig, JsonSerializationContext context) { JsonArray modules = new JsonArray(); for (ProjectConfig config : moduleConfig.getModules()) { modules.add(serializeModule(config, context)); } return modules; }
private JsonElement serializeModule( ProjectConfig moduleConfig, JsonSerializationContext context) { JsonObject object = new JsonObject(); object.addProperty("name", moduleConfig.getName()); object.addProperty("path", moduleConfig.getPath()); object.addProperty("type", moduleConfig.getType()); object.addProperty("content_root", moduleConfig.getContentRoot()); object.add("attributes", context.serialize(moduleConfig.getAttributes())); object.add("modules", serializeModules(moduleConfig, context)); object.add("source", context.serialize(moduleConfig.getSource())); return object; }