-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Milestone
Description
i am developing project using kotlin and have the following classes
DTO class
data class TestDTO (
val name: String,
val type: String
)
Model class
@Entity
data class Test (
@Column(name = "name")
val name: String? = null,
@Column(name = "type")
val type: String? = null,
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(columnDefinition = "BIGINT")
val id: BigInteger? = null
)
Mapper Class
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR)
interface TestMapper {
fun convertToTest(testDTO: TestDTO): Test
}
I expected the generated mapper will use constructor to create the Test class (the model), but the result is like below
@Component
public class TestMapperImpl implements TestMapper {
@Override
public Test convertToTest(TestDTO testDTO) {
if ( testDTO == null ) {
return null;
}
Test test = new Test();
return test;
}
}
why is it using the empty constructor of Test, can we use the Test(name, type) constructor?
Reactions are currently unavailable