Skip to content

Commit

Permalink
Merge remote-tracking branch 'Tim203/feature/interfaces'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Feb 13, 2024
2 parents 5b193ba + 7e45e31 commit e791045
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,23 @@ canonicalName, availableMappings()
}

@Override
@SuppressWarnings({"rawtypes", "unchecked"})
public void serialize(
final Type type,
final @Nullable Object obj,
final ConfigurationNode node
) throws SerializationException {
throw new SerializationException(
"I can only deserialize stuff. Serialization has to be handled by ObjectMapper!"
);
// don't determine serialize from type, because that might be incorrect for subsections
if (obj == null) {
node.set(null);
return;
}

final @Nullable TypeSerializer serializer = node.options().serializers().get(obj.getClass());
if (serializer == null) {
throw new SerializationException("No serializer found for implementation class " + obj.getClass());
}
serializer.serialize(obj.getClass(), obj, node);
}

private String availableMappings() {
Expand Down

0 comments on commit e791045

Please sign in to comment.