mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
changed serializers to deal with switch serialization pair
This commit is contained in:
1 parent
1c81230e8c
commit
0f1efe52db
2 files changed
+6
-6
No files matched your search
+3
-3
@@ -38,11 +38,11 @@ public class DeviceIdentifierJsonSerializer implements JsonSerializer<DeviceIden
|
||||
public JSONObject serialize(DeviceIdentifier object) {
|
||||
JSONObject result = new JSONObject();
|
||||
DeviceIdentifierJsonHandler handler = serviceFinder.findService(object.getIdentifierType());
|
||||
Pair<? extends Object, String> pair;
|
||||
Pair<String, ? extends Object> pair;
|
||||
try {
|
||||
pair = handler.serialize(object);
|
||||
result.put(DeviceIdentifierJsonDeserializer.FIELD_DEVICE_ID, pair.getA());
|
||||
result.put(DeviceIdentifierJsonDeserializer.FIELD_DEVICE_TYPE, pair.getB());
|
||||
result.put(DeviceIdentifierJsonDeserializer.FIELD_DEVICE_TYPE, pair.getA());
|
||||
result.put(DeviceIdentifierJsonDeserializer.FIELD_DEVICE_ID, pair.getB());
|
||||
result.put(DeviceIdentifierJsonDeserializer.FIELD_STRING_REPRESENTATION, object.getStringRepresentation());
|
||||
return result;
|
||||
} catch (TransformationException e) {
|
||||
|
||||
Reference in new issue
Block a user