It may not work to use generics when defining mappings in Orika
1106285275 opened this issue · 0 comments
1106285275 commented
jdk 1.8
maven:
ma.glasnost.orika
orika-core
1.5.1
my test code:
`@Data
@AllArgsConstructor
public class NotifyMsg {
private Long uid;
private T msgData;
}
@DaTa
@AllArgsConstructor
public class DeviceNotify {
private String did;
private String state;
}
public static void main(String[] args) {
DeviceNotify deviceNotify = new DeviceNotify("test", "active");
NotifyMsg notifyMsg = new NotifyMsg<>(111L, deviceNotify);
MapperFactory factory = new DefaultMapperFactory.Builder().build();
Type<NotifyMsg<DeviceNotify>> sourceType = new TypeBuilder<NotifyMsg<DeviceNotify>>() {
}.build();
Type<NotifyMsg<DeviceNotify>> targetType = new TypeBuilder<NotifyMsg<DeviceNotify>>() {
}.build();
factory.classMap(sourceType, targetType).byDefault().register();
NotifyMsg<DeviceNotify> targetObj = factory.getMapperFacade().map(notifyMsg, sourceType, targetType);
System.out.println(targetObj);
}
`