Skip to content

map generics #2377

@chriswill0w

Description

@chriswill0w

I am trying to map generics like this:

    public static <T, X> Nullable<X> jsonNullableToNullable(JsonNullable<T> jsonNullable) {
        if (jsonNullable.isPresent()) {
            return Nullable.of(jsonNullable.get());
        }
        return Nullable.undefined();
    }

But how do I tell mapstruct in line return Nullable.of(jsonNullable.get()) to call the appropriate mapper to map from T to X?

I have also opened a stackoverflow question with all the details: https://stackoverflow.com/questions/66452786/mapstruct-wrapper-type-and-generics

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions