org.araneaframework.backend.list.helper.naming
Class PrefixMapNamingStrategy
java.lang.Object
org.araneaframework.backend.list.helper.naming.StandardNamingStrategy
org.araneaframework.backend.list.helper.naming.PrefixMapNamingStrategy
- All Implemented Interfaces:
- NamingStrategy
- public class PrefixMapNamingStrategy
- extends StandardNamingStrategy
Improved naming conventions between list fields and database columns
which enables to defined custom prefixes for database column names.
If one is using multiple tables (with aliases) in one SELECT,
addPrefix(String, String) should be called to transform list field names
correspondingly into database column names.
Field names are transformed into database column names as following:
- The full name is split into prefix and suffix (following to the last dot).
- If
addPrefix(String, String) has been called with the current prefix
it is replaced with the corresponding String (table alias).
- Otherwise all dots in the prefix and suffix are converted into underscores.
- Before each upper case letter followed by lower case an underscore is inserted.
Field names are transformed into database column aliases as following:
- All dots are converted into underscores.
- Before each upper case letter followed by lower case an underscore is inserted.
- Since:
- 1.1
- Author:
- Rein Raudjärv
- See Also:
StandardNamingStrategy
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PrefixMapNamingStrategy
public PrefixMapNamingStrategy()
addPrefix
public PrefixMapNamingStrategy addPrefix(String fieldNamePrefix,
String columnNamePrefix)
- Add a mapping between a prefix in field name
and a prefix in database column name (usually a table alias).
E.g.
addPrefix("location", "L")
addPrefix("mother.mother", "MM")
- Parameters:
fieldNamePrefix - prefix of the field name (can also be null).columnNamePrefix - prefix of the database column name (can also be null).
resolvePrefix
protected String resolvePrefix(String fieldNamePrefix)
- Overrides:
resolvePrefix in class StandardNamingStrategy