Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide extension point for detecting "primary" Constructor for Kotlin (and similar) data classes #4584

Closed
JooHyukKim opened this issue Jun 16, 2024 · 0 comments
Labels

Comments

@JooHyukKim
Copy link
Member

JooHyukKim commented Jun 16, 2024

Is your feature request related to a problem? Please describe.

Relates to and described in FasterXML/jackson-module-kotlin#805, to help better reduce maintenance points on module side.

Describe the solution you'd like

Provide extension point for modules (esp. per language, like jackson-module-kotlin) to indicate primary Creator (usually properties-based constructor) to use if no annotations used: this is typically referred to as "Canonical" creator. Concept also exists in Java, for Record types.

The most obvious approach would be to add a new method (or methods) in AnnotationIntrospector as this is an existing extensible mechanism already used by language modules.

Usage example

Usage to be discussed.

Additional context

See #4515 for work that enabled possibility to detect Canonical creator (for Java Records).

Feel free to edit the title and all @cowtowncoder

@JooHyukKim JooHyukKim added the to-evaluate Issue that has been received but not yet evaluated label Jun 16, 2024
@cowtowncoder cowtowncoder added 2.18 and removed to-evaluate Issue that has been received but not yet evaluated labels Jul 1, 2024
@cowtowncoder cowtowncoder changed the title Provide extension point for detecting "canonical" Constructor for Kotlin (data) classes Provide extension point for detecting "primary" Constructor for Kotlin (data) classes Jul 10, 2024
@cowtowncoder cowtowncoder changed the title Provide extension point for detecting "primary" Constructor for Kotlin (data) classes Provide extension point for detecting "primary" Constructor for Kotlin (and similar) data classes Jul 10, 2024
cowtowncoder added a commit that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants