Skip to content

Commit

Permalink
Bake UUID support into PersistenceLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 7, 2020
1 parent 4194145 commit 1fff14d
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -247,6 +247,9 @@ private static Object deserialiseValue(PersistField field, DataKey root) {
}
}
}
if (field.delegate == null && type == UUID.class) {
return UUID.fromString(root.getString(""));
}
return field.delegate == null ? root.getRaw("") : field.delegate.create(root);

}
Expand Down Expand Up @@ -463,6 +466,8 @@ private static void serialiseValue(PersistField field, DataKey root, Object valu
((Persister<Object>) field.delegate).save(value, root);
} else if (value instanceof Enum) {
root.setRaw("", ((Enum<?>) value).name());
} else if (value instanceof UUID) {
root.setString("", ((UUID) value).toString());
} else {
root.setRaw("", value);
}
Expand Down

0 comments on commit 1fff14d

Please sign in to comment.