use of org.kie.workbench.common.forms.model.ModelMetaData in project kie-wb-common by kiegroup.
the class FormDefinitionSerializerImpl method deserialize.
@Override
public FormDefinition deserialize(String serializedForm) {
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(FormModel.class, formModelSerializer);
builder.registerTypeAdapter(FieldDefinition.class, fieldSerializer);
builder.registerTypeAdapter(ModelProperty.class, (JsonDeserializer<ModelProperty>) (json, typeOfT, context) -> context.deserialize(json, ModelPropertyImpl.class));
builder.registerTypeAdapter(TypeInfo.class, (JsonDeserializer<TypeInfo>) (json, typeOfT, context) -> context.deserialize(json, TypeInfoImpl.class));
builder.registerTypeAdapter(ModelMetaData.class, (JsonDeserializer<ModelMetaData>) (json, typeOfT, context) -> context.deserialize(json, ModelMetaDataImpl.class));
builder.registerTypeAdapter(MetaDataEntry.class, (JsonDeserializer<MetaDataEntry>) (json, typeOfT, context) -> {
JsonObject jsonField = json.getAsJsonObject();
JsonElement jsonName = jsonField.get("name");
return context.deserialize(json, metaDataEntryManager.getMetaDataEntryClass(jsonName.getAsString()));
});
Gson gson = builder.create();
return gson.fromJson(serializedForm, FormDefinition.class);
}
Aggregations