Skip to content

Automatic constructor "recognition" #19

Description

@Idane

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions