Mapstruct 1.4.1 migration with qualifiedBy

Viewed 152

Migrating from Mapstruct 1.3.1 -> 1.4.1,

I have an annotation:

@Qualifier
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface ElementToList {

}

And implementation

@Component

public class ElementToListUtil {

    @ElementToList
    public <T> List<T> first(T in) {
        List<T> list = new ArrayList<>();

        if (in != null) {
            list.add(in);
        }

        return list;
    }

}

and a tag on my mapping:

@Mapping(source = "blah", target = "fooArray", qualifiedBy = ElementToList.class)

This used to work, but now it is breaking with:

error: Qualifier error. No method found annotated with: [ @ElementToList ]. See https://mapstruct.org/faq/#qualifier for more info.
                         ^
Can't map property "Foo foo" to "List<bar> barArray". Consider to declare/implement a mapping method: "List<bar> map(foo value)".

Am I missing something?

0 Answers
Related