According to code conventions for the Java programming language, for class names
Class names must be nouns in the mixed case with the first letter, each inner word is capitalized. Try to keep simple class names and descriptive. Use whole words - avoid abbreviations and abbreviations (if the abbreviation is much more widely used than a long form, such as URL or HTML).
And variable names
With the exception of variables, all instance, class, and class constants in the mixed case with a lowercase letter. Inner words begin with capital letters.
You can use these methods to convert database
names to Java
names.
public static String toJavaFieldName(String name) { // "MY_COLUMN" String name0 = name.replace("_", " "); // to "MY COLUMN" name0 = WordUtils.capitalizeFully(name0); // to "My Column" name0 = name0.replace(" ", ""); // to "MyColumn" name0 = WordUtils.uncapitalize(name0); // to "myColumn" return name0; } public static String toJavaClassName(String name) { // "MY_TABLE" String name0 = name.replace("_", " "); // to "MY TABLE" name0 = WordUtils.capitalizeFully(name0); // to "My Table" name0 = name0.replace(" ", ""); // to "MyTable" return name0; }
These methods use Apache Commons Lang .
source share