Search in sources :

Example 1 with ChangeType

use of org.summerb.easycrud.api.dto.EntityChangedEvent.ChangeType in project summerb by skarpushin.

the class EntityChangedEventAdapter method deserialize.

@SuppressWarnings({ "unchecked", "deprecation" })
@Override
public EntityChangedEvent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObject = json.getAsJsonObject();
    Class<? extends DtoBase> klass = resolveParametersClass(jsonObject);
    JsonElement jsonElement = jsonObject.get(INSTANCE);
    DtoBase value = context.deserialize(jsonElement, klass);
    ChangeType changeType = context.deserialize(jsonObject.get("ct"), ChangeType.class);
    return new EntityChangedEvent(value, changeType);
}
Also used : DtoBase(org.summerb.utils.DtoBase) ChangeType(org.summerb.easycrud.api.dto.EntityChangedEvent.ChangeType) EntityChangedEvent(org.summerb.easycrud.api.dto.EntityChangedEvent) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Aggregations

JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 EntityChangedEvent (org.summerb.easycrud.api.dto.EntityChangedEvent)1 ChangeType (org.summerb.easycrud.api.dto.EntityChangedEvent.ChangeType)1 DtoBase (org.summerb.utils.DtoBase)1