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

Support for adding annotations to generated classes #775

Open
johno1985 opened this issue May 21, 2018 · 4 comments
Open

Support for adding annotations to generated classes #775

johno1985 opened this issue May 21, 2018 · 4 comments
Labels

Comments

@johno1985
Copy link

johno1985 commented May 21, 2018

I have some javax.ws validations annotations that I need to add to my generated immutables classes. Is there a way to do this? I did see the following section of the documenation:
http://immutables.github.io/immutable.html#annotation-injection

But it does not go into much detail, also, I tried adding the @InjectAnnotation to my type but this just results in a compilation error "InjectAnnotation cannot be resolved to a type"

@elucash
Copy link
Member

elucash commented May 21, 2018

@InjectAnnotation is in org.immutables:annotate module, which should be added as an additional compile-only dependency.
For the bean validation (sorry if it's the other kind of validation) please see general discussion #26 and #513 introducing Style.validationMethod flag

@johno1985
Copy link
Author

Ah perfect, didn't realise there was a passAnnotations style, thanks

@vsrikrishna32
Copy link

Using @InjectAnnotation is there a way to format the !name parameter. For example, I would like a method
void getFooBar()
to be annotated as
@MyAnnotation(value = "FOO_BAR") void getFooBar() instead of
@MyAnnotation(value = "getFooBar") void getFooBar()

@elucash
Copy link
Member

elucash commented May 24, 2018

@vsrikrishna32 thank you for trying out @InjectAnnotation! Currently there's no such feature to format !name. There's a number of conversions can be implemented, but "development time vs how many people will actually use" kind of balance suggest that it's probably not enough motivation for this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants