Skip to content

Document overriding of ValueMapper's builtin converters and type mappings #1454

@netvl

Description

@netvl

Currently it is unclear from the documentation how conversions, converter factories and type mappings can be customized with relation to the built-in ones. For example, I have to do this if I want to create a custom conversion which overrides one of the built-in ones:

ValueMapperBuilder.preconfigured()
  .addConversions(myCustomConversions) // takes priority over built-in ones

but if I want to override a converter factory, I have to do it in a more complicated way:

ValueMapperBuilder.unconfigured()
  .addConversions(Conversions.all)
  .addConverterFactories(myCustomConverterFactories) // takes priority over built-in ones
  .addConverterFactories(ConverterFactories.all)
  .addTypeMappings(TypeMappings.all)

(because, apparently, earlier converter factories have priority over later ones, but later conversions have priority over earlier ones)

Ideally, this behavior should be documented somewhere, and probably unified (so e.g. the shorter form always works, for all types of customizations).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions