You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using shapeshift 0.9.0. Not sure if this a bug or I'm just misunderstanding the documentation.
I have a Src class which is provided and can't be changed (so it's not possible to add annotations there).
I'd like to map this class to my Dest class. I'd like to use auto mapping, because I'm lazy :-), and I have to provide an object instance, because the Dest class lacks an empty constructor. Adding an empty constructor with the no-args plugin should be avoided if possible.
This is my example code:
data class Src(
val id: String,
val name: String,
val telephone: String,
)
data class Dest(
val id: String,
val name: String,
val telephone: String,
)
fun main(args: Array<String>) {
val src = Src("42", "Dr Dolittle", "123456789")
val mapper = mapper<Src, Dest> { autoMap(AutoMappingStrategy.BY_NAME_AND_TYPE) }
val shapeShift = ShapeShiftBuilder().withMapping<Src, Dest> { mapper.mappingDefinition }.build()
val destTemplate = Dest("fake", "fake", "fake")
val dest = shapeShift.map(src, destTemplate)
println(dest)
}
But, when running this, dest is only the provided "fake" class, and no values from Src have been mapped.
The text was updated successfully, but these errors were encountered:
I'm using shapeshift 0.9.0. Not sure if this a bug or I'm just misunderstanding the documentation.
I have a Src class which is provided and can't be changed (so it's not possible to add annotations there).
I'd like to map this class to my Dest class. I'd like to use auto mapping, because I'm lazy :-), and I have to provide an object instance, because the Dest class lacks an empty constructor. Adding an empty constructor with the no-args plugin should be avoided if possible.
This is my example code:
But, when running this, dest is only the provided "fake" class, and no values from Src have been mapped.
The text was updated successfully, but these errors were encountered: