ModelMapper modelMapper = new ModelMapper();
Gson gson = new GsonBuilder().create();
String json = ...
GenericEntity genericEntity = gson.fromJson(json, GenericEntity.class);
switch(genericEntity.getType){
case FUELL:
Fuell fuell = modelMapper.map(genericEntity, Fuell.class);
break;
case AMENITY:
Amenity amenity = modelMapper.map(genericEntity, Amenity.class);
break;
}
А именно загвостка в DTO vs. Entity