use of com.cloud.agent.transport.InterfaceTypeAdaptor in project cloudstack by apache.
the class GsonHelper method setDefaultGsonConfig.
static Gson setDefaultGsonConfig(GsonBuilder builder) {
builder.setVersion(1.5);
InterfaceTypeAdaptor<DataStoreTO> dsAdaptor = new InterfaceTypeAdaptor<DataStoreTO>();
builder.registerTypeAdapter(DataStoreTO.class, dsAdaptor);
InterfaceTypeAdaptor<DataTO> dtAdaptor = new InterfaceTypeAdaptor<DataTO>();
builder.registerTypeAdapter(DataTO.class, dtAdaptor);
ArrayTypeAdaptor<Command> cmdAdaptor = new ArrayTypeAdaptor<Command>();
builder.registerTypeAdapter(Command[].class, cmdAdaptor);
ArrayTypeAdaptor<Answer> ansAdaptor = new ArrayTypeAdaptor<Answer>();
builder.registerTypeAdapter(Answer[].class, ansAdaptor);
builder.registerTypeAdapter(new TypeToken<List<PortConfig>>() {
}.getType(), new PortConfigListTypeAdaptor());
builder.registerTypeAdapter(new TypeToken<Pair<Long, Long>>() {
}.getType(), new NwGroupsCommandTypeAdaptor());
Gson gson = builder.create();
dsAdaptor.initGson(gson);
dtAdaptor.initGson(gson);
cmdAdaptor.initGson(gson);
ansAdaptor.initGson(gson);
return gson;
}
Aggregations