Dont need to deserialize enum if it is already an enum

This commit is contained in:
Ben Woo 2024-10-12 13:43:17 +08:00
parent 9c929fccca
commit 7868a1971e

View File

@ -43,6 +43,9 @@ public final class DefaultSerializerProvider {
private static final NodeSerializer<Enum> ENUM_SERIALIZER = new NodeSerializer<>() {
@Override
public Enum<?> deserialize(Object object, Class<Enum> type) {
if (type.isInstance(object)) {
return (Enum<?>) object;
}
return Enum.valueOf(type, String.valueOf(object).toUpperCase());
}