use of edu.stanford.bmir.protege.web.shared.form.FormDescriptor in project webprotege by protegeproject.
the class FormDescriptorDeserializer method deserialize.
@Override
public FormDescriptor deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
if (!jsonElement.isJsonObject()) {
throw createParseException(jsonElement, "Object");
}
JsonObject object = jsonElement.getAsJsonObject();
String id = object.getAsJsonPrimitive("id").getAsString();
JsonArray fieldsArray = object.getAsJsonArray("fields");
List<FormElementDescriptor> formElementDescriptors = new ArrayList<>();
for (JsonElement fieldElement : fieldsArray) {
FormElementDescriptor elementDescriptor = jsonDeserializationContext.deserialize(fieldElement, FormElementDescriptor.class);
formElementDescriptors.add(elementDescriptor);
}
return new FormDescriptor(new FormId(id), formElementDescriptors);
}
Aggregations