Skip to content

Plugin won't recognize @Named class #247

Description

@BartekGierej

I was trying to implement this pattern from documentation:

Image

As for mapper itself, it is working fine and dandy. The plugin, however, seems to have problem with finding the annotated class which contains annotated mapping method. Error description is provided:

"Unknown @ Named reference 'TranslationMapper' ".

Reference for "TranslationsToString" is found properly.

@Mapper(uses = TranslationMapper.class)
public interface PrimaryClassMapper {
    @Mapping(source = "primary.id", target = "id")
    @Mapping(
            source = "primary.translatedNames",
            target = "name",
            qualifiedByName = {"TranslationMapper", "TranslationsToString"})
    SecondaryClass toSecondaryClass(PrimaryClass primary, @Context Language targetLanguage);
}
@Named("TranslationMapper")
public class TranslationMapper {
    @Named("TranslationsToString")
    public String resolveTranslatedText(
            List<TranslationDto> translations, @Context Language targetLanguage) {
        //some fancy logic
    }
}

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