{"action":"created","issue":{"url":"https://api.github.com/repos/immutables/immutables/issues/26","repository_url":"https://api.github.com/repos/immutables/immutables","labels_url":"https://api.github.com/repos/immutables/immutables/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/immutables/immutables/issues/26/comments","events_url":"https://api.github.com/repos/immutables/immutables/issues/26/events","html_url":"https://github.com/immutables/immutables/issues/26","id":42135617,"number":26,"title":"validation: support for javax.validation API","user":{"login":"toellrich","id":5838959,"avatar_url":"https://avatars.githubusercontent.com/u/5838959?v=3","gravatar_id":"","url":"https://api.github.com/users/toellrich","html_url":"https://github.com/toellrich","followers_url":"https://api.github.com/users/toellrich/followers","following_url":"https://api.github.com/users/toellrich/following{/other_user}","gists_url":"https://api.github.com/users/toellrich/gists{/gist_id}","starred_url":"https://api.github.com/users/toellrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toellrich/subscriptions","organizations_url":"https://api.github.com/users/toellrich/orgs","repos_url":"https://api.github.com/users/toellrich/repos","events_url":"https://api.github.com/users/toellrich/events{/privacy}","received_events_url":"https://api.github.com/users/toellrich/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/immutables/immutables/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-09-07T05:52:50Z","updated_at":"2016-05-31T21:03:04Z","closed_at":null,"body":"I came across this awesome library when you posted that message on the Guava mailing list the other day. Too bad they haven't answered you yet. \r\n\r\nI would like to start using it for generating objects that are exchanged via JAX-RS in combination with the bean validation API for which Jersey has build-in support. Unfortunately that requires me to follow the JavaBean convention of prefixing the method names with 'get'/'is':\r\n\r\nhttp://docs.jboss.org/hibernate/validator/5.1/reference/en-US/html_single/#d0e349\r\n\r\nWould you consider prefixing the generated builder method names with 'set' if the method names start with 'get'/'is'? Setters with getter method names in a builder, that's just wrong.\r\n\r\nI understand where you're coming from in eschewing this convention in your documentation (after all if there are no setters why should there by getters), but maybe in this case an exception could be made?\r\n\r\nAnyway, thanks for sharing this great library."},"comment":{"url":"https://api.github.com/repos/immutables/immutables/issues/comments/222819673","html_url":"https://github.com/immutables/immutables/issues/26#issuecomment-222819673","issue_url":"https://api.github.com/repos/immutables/immutables/issues/26","id":222819673,"user":{"login":"elucash","id":1692611,"avatar_url":"https://avatars.githubusercontent.com/u/1692611?v=3","gravatar_id":"","url":"https://api.github.com/users/elucash","html_url":"https://github.com/elucash","followers_url":"https://api.github.com/users/elucash/followers","following_url":"https://api.github.com/users/elucash/following{/other_user}","gists_url":"https://api.github.com/users/elucash/gists{/gist_id}","starred_url":"https://api.github.com/users/elucash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elucash/subscriptions","organizations_url":"https://api.github.com/users/elucash/orgs","repos_url":"https://api.github.com/users/elucash/repos","events_url":"https://api.github.com/users/elucash/events{/privacy}","received_events_url":"https://api.github.com/users/elucash/received_events","type":"User","site_admin":false},"created_at":"2016-05-31T21:03:04Z","updated_at":"2016-05-31T21:03:04Z","body":"> I am not sure if JSR-303 validation fits at all, even with generated getters...\r\n\r\nSurely, we cannot expect that existing implementations of the bean validation will handle immutable object gracefully, but the original value in such integration appeared to be in a fact of reuse of the annotations/API and validation extensibility model specified by JSR-303.\r\n\r\nAs of now there are no plans to work on JSR-303 integration, as in most cases the preferred approach to validation is to use appropriate types and preconditions. I mean if you received a message with an email `String`, then you convert it to `Email` value object which in by definition is valid once constructed (it cannot be constructed in invalid state), and so on. Of course, this approach cannot cover all of use cases, and some support classes to collect and propagate violations should still be used, as opposed to throwing a runtime exception on first violation encountered.\r\n\r\nI cannot be sure it will work, but you may try to use `@Value.Modifiable` generated companion objects (with `Style.create = \"new\"` to have public non-final class & constructor). This way you can annotate abstract value type and validate modifiable object, rather than immutable implementation. There are `.from` and `.toImmutable` methods to convert modifiable from and to immutable object."}}
{"actor":{"display_login":"elucash"}}