1

从 Mapstruct 1.3.1 -> 1.4.1 迁移,

我有一个注释:

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

}

和实施

@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;
    }

}

和我的映射上的标签:

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

这曾经有效,但现在它打破了:

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)".

我错过了什么吗?

4

0 回答 0