blob: b14c3b19a273c9fb1827b7a699a5797d17fff039 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
import com.google.gson.*;
import java.lang.reflect.Type;
public class ConditionDeserializer implements JsonDeserializer<BaseCondition> {
@Override
public BaseCondition deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
Type clazz = Condition.class;
JsonElement type = json.getAsJsonObject().get("type");
if(null != type && !type.isJsonNull())
clazz = ConditionGroup.class;
return context.deserialize(json, clazz);
}
}
|