Skip to content

It may not work to use generics when defining mappings in Orika #400

@1106285275

Description

@1106285275

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);

}

but this code got exception:
image

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions