Thursday, September 25, 2014

ADF - Named Bind Variable Accessors Do Not Follow Naming Convention

When you generate a custom Java class for your view object, you can choose to "Include bind variable accessors":

Select Java Options Dialog
Select Java Options

JDeveloper will automatically add get/set methods as applicable for all the named bind variables of the view object. It's annoying that these accessors do not follow the standard naming conventions in that they do not automatically capitalize the first letter of the bind variable name. For example, if the view object EmployeeView defines a bind variable with the name "firstNameVariable", then the accessors will be like this:

public void setfirstNameVariable(String value);
public String getfirstNameVariable();

To make it follow the naming convention, you can manually edit the generated code to fix the names. Beware that whenever you regenerate the source code, you have to fix it again.

You can also choose to name your bind variables with an initial capital letter. That makes your accessors look better. Although initial capital letters also break the conventions for variable names, considering that ADF also use initial capital letters in attribute names for view and entity objects, this approach seems better than the first one, before JDeveloper fix this issue.

No comments:

Post a Comment