Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1106285275 opened this issue Mar 11, 2024 · 0 comments
Open

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

1106285275 opened this issue Mar 11, 2024 · 0 comments

Comments

@1106285275
Copy link

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

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant