- This topic has 2 replies, 2 voices, and was last updated 11 years, 7 months ago by support-tony.
-
AuthorPosts
-
Paul ZepernickMemberThere seems to be an issue generating the getters and setters for variable names that only have 1 char in the first part of the variable name before the camel case. For example:
private Integer sEcho;
This generates as:
public Integer getsEcho() { return sEcho; } public void setsEcho(Integer sEcho) { this.sEcho = sEcho; }
This causes Struts to not be able to set the properties to my struts action. Notice the lowercase “s” right after the get and set. It should be:
public Integer getSEcho() { return sEcho; } public void setSEcho(Integer sEcho) { this.sEcho = sEcho; }
Thanks,
Paul
Paul ZepernickMemberIt looks like this is a eclipse issues, kind of….They are leaving the functionality as is after some debate. I am getting burned by it currently. I have to define the vars like this because of the DataTables JS lib that sends these naming conventions.
I just ran into a situation where Struts wants the first char upper case, and the Common Bean Utils wants the first letter lower case like eclipse generated in the first place. I now currently have my gets and sets generated both ways to get it to work 🙁
support-tonyKeymasterPaul,
This is a tricky one. It looks like the eclipse developers have gone for conformance to JavaBean conventions, as mentioned in this bug. However, the base Java conventions would seem to imply that the alternative naming (uppercase first letter in all cases), as mentioned in the bug you linked to.
As you’ve seen, different frameworks have conflicting conventions that need to be adhered to, so it’s difficult to see which should be the correct format. You seem to have to effectively duplicate getters and setters, using both conventions, at least in the case of property names having the single lowercase starting letter, to get round these issues.
I’m not sure there is anything more that can be done, given that one naming strategy will be wrong in some cases and the other naming strategy will be wrong in other cases.
If you have further suggestions on this, do let us know.
-
AuthorPosts