Skip to content

@Named annotations should be used as service discriminator if present #3

@cjbooms

Description

@cjbooms

The annotation processor should look for the presence of a javax.inject.Named annotation on the current javax.lang.model.element.Element being processed. Be that a class annotated with @ServiceExport, or a field or parameter annotated with @ServiceImport

This can easily be checked using:

javax.inject.Named named = componentClazz.getAnnotation(javax.inject.Named.class);

If present, the value should be used as a discriminator when generating the Peaberry imports and exports. For example:

                bind(export(ServiceOne.class))
                        .annotatedWith(Names.named("someBeanName"))
                        .toProvider(service(ServiceOneImpl.class)
                                .attributes(attributes)
                                .export());

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