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

Automatic constructor "recognition" #19

Open
Idane opened this issue Mar 1, 2023 · 0 comments
Open

Automatic constructor "recognition" #19

Idane opened this issue Mar 1, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Idane
Copy link
Member

Idane commented Mar 1, 2023

The goal of this task is to make ShapeShift mapping work with constructor injection, to avoid having to supply object suppliers for every object.

Preliminary conclusions:

  • Will probably need special behaviour for java/kotlin
  • There doesn't seem to be a way to retrieve default values from constructors

Simplest example:

@DefaultMappingTarget(
class FromClass {
    @MappedField
    var first: String "first"
    @MappedField
    var second: String = "second"
}

class ToClass(
    val first: String,
    val second: String,
    val third: String?
)

Should result in a new instance of ToClass with the fields first and second mapped, and the field third being passed to the constructor as null

@Idane Idane added enhancement New feature or request help wanted Extra attention is needed labels Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant