-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
When using a custom type in a map within a config, e.g.:
@Configuration
class MyMessagesConfig {
Map<MyCustomType, String> translations;
}With MyCustomType having a @SerializeWith(serializer = ...) annotation (with the serializer serializing to String), I am unable to serialize/deserialize this type:
myplugin.shaded.configlib.ConfigurationException: Cannot select serializer for type 'java.util.Map<myplugin.MyCustomType, java.lang.String>'.
Map keys can only be of simple or enum type.
I recognize that key types are more limited, I presume they can only be of type String and not of any other primitive type. But when having a (de)serializer that serializes to and from Strings, I think this should be possible.
In my usecase, MyCustomType is a glorified enum with some custom logic. The (de)serializer simply gets the name of the type, and fetches the type again by the name when deserializing.