// Get metadata for the Module
List<JsonElement> requestElements = new ArrayList<JsonElement>();
JsonObject moduleJsonObject = gson.fromJson(output, JsonObject.class);
JsonElement moduleNameElement = moduleJsonObject.get("moduleName");
JsonElement moduleDescriptionElement = moduleJsonObject.get("moduleDescription");
JsonElement moduleVersionElement = moduleJsonObject.get("moduleDescription");
String moduleName = "default_module_name";
String moduleDescription = "default_module_description";
String moduleVersion = "1.0";
if (moduleNameElement != null && !moduleNameElement.getAsString().isEmpty()) {
moduleName = moduleNameElement.getAsString();
}
if (moduleDescriptionElement != null && !moduleDescriptionElement.getAsString().isEmpty()) {
moduleDescription = moduleDescriptionElement.getAsString();
}
if (moduleVersionElement != null && !moduleDescriptionElement.getAsString().isEmpty()) {
moduleDescription = moduleVersionElement.getAsString();
}
// Get all 'functions' as JsonObjects from the file and add them as a
// list
JsonElement functions = JsonUtils.findElement(moduleJsonObject, "functions");
if (functions != null) {
if (functions.isJsonArray()) {
JsonArray requests_array = functions.getAsJsonArray();
for (JsonElement requestElement : requests_array) {
if (requestElement.isJsonObject()) {
JsonObject request = requestElement.getAsJsonObject();
requestElements.add(request);
}