jackson-module-kotlin icon indicating copy to clipboard operation
jackson-module-kotlin copied to clipboard

Add addMixIn Extension Function

Open Sylvain-maillard opened this issue 3 years ago • 3 comments

Use case I use MixIn and I find that it could be cool to use reified types instead of T::Class.java structure when you add some mixin to the mapper.

Describe the solution you'd like

I'd like to add this extension function to the module:

inline fun <reified T, reified U> ObjectMapper.addMixIn(): ObjectMapper = this.addMixIn(T::class.java, U::class.java)

Describe alternatives you've considered

NA

Additional context

I can provide the PR but I'm not sure about the version/branch to target.

Sylvain-maillard avatar Mar 14 '22 09:03 Sylvain-maillard

I'd probably recommend not adding too many new mutator methods on ObjectMapper since that approach will disappear with Jackson 3.0 (... in due time), and instead of that add to ObjectMapper.Builder alternative.

But aside from that, branch to use would be 2.14 since this is API change and cannot go in a patch version. And you probably do not want to wait until 3.0 either (which is what master is for).

cowtowncoder avatar Mar 14 '22 22:03 cowtowncoder

Hi @cowtowncoder , thanks for pour message, I've opened a pull request on 2.14 branch, Hope this will be ok 🙂

Sylvain-maillard avatar Mar 15 '22 18:03 Sylvain-maillard

Yeah that's fine, it'd be for Kotlin module maintainers (@dinomite ) to review and approve.

cowtowncoder avatar Mar 15 '22 20:03 cowtowncoder

Closed due to merging.

k163377 avatar Apr 08 '23 16:04 k163377