Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cjbooms opened this issue Sep 3, 2015 · 0 comments
Open

Comments

@cjbooms
Copy link
Contributor

cjbooms commented Sep 3, 2015

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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant