Minto van der Sluis created ISIS-325: ----------------------------------------
Summary: Field validation annotations should be on setters or fields instead of on the getters. Key: ISIS-325 URL: https://issues.apache.org/jira/browse/ISIS-325 Project: Isis Issue Type: Bug Components: Core Affects Versions: core-1.1.0 Reporter: Minto van der Sluis Assignee: Dan Haywood Priority: Minor Below is the discussion on the mailing list On 2 February 2013 15:29, Minto van der Sluis wrote: In the quickstart ToDo application I just noticed the following: @RegEx( validation = "\\w[@&:\\-\\,\\.\\+ \\w]*" ) // words, spaces and selected punctuation @MemberOrder( sequence = "2" ) public String getDescription() { ... To me it seems like validation is specified on the getter method. Is this correct? Shouldn't this be specified on the setter or the member field instead? On 3 February 2013 16:04, Dan Haywoord wrote: I agree that it might seem a bit confusing, but at the moment all the FacetFactory's only ever read the getter method for properties. I don't see anything in principal for extending the FacetFactory's to also look at fields and setters; in this particular case I could well imagine that someone might expect the annotation to live on the setter. The same is true for annotations such as @MaxLength. Another benefit of having the FacetFactory's look at the fields is that then Lombok [1] could be configured. This would save a lot of boilerplate, as I know you know. Making the change is relative straightforward, it's just a matter of doing a lot "grunt" work to quite a lot of existing FacetFactory's. I wouldn't have any objection to applying any patches received, though. And if you want to raise a ticket for this idea, please go ahead. Cheers Dan [1] http://projectlombok.org/ -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira