@Override public Sct013 deserialize( JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { JsonObject jo = jsonElement.getAsJsonObject(); Sct013 element = new Sct013(); SerializerUtil.deserializeAbstractSensor(jo, element); // Spezifische Daten serialisieren element.setActualPower(jo.get("actualPower").getAsDouble()); return element; }
@Override public JsonElement serialize( Sct013 sct013, Type type, JsonSerializationContext jsonSerializationContext) { JsonObject jo = new JsonObject(); SerializerUtil.serializeAbstractSensor(jo, sct013); // Spezifische Daten serialisieren jo.add("actualPower", new JsonPrimitive(sct013.getActualPower())); return jo; }