1 package org.onap.sdc.dcae.ves;
3 import com.google.gson.*;
5 import java.lang.reflect.Type;
7 // json 'items' value can be either a single object or an array. customized POJO will always be an array
8 public class VesJsonDeserializer implements JsonDeserializer<VesDataItemsDefinition> {
10 public VesDataItemsDefinition deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
12 if(json instanceof JsonArray){
13 return new Gson().fromJson(json, VesDataItemsDefinition.class);
16 VesDataItemsDefinition items = new VesDataItemsDefinition();
17 items.add(new Gson().fromJson(json, VesDataTypeDefinition.class));