java.lang.Object
io.ebean.config.AbstractNamingConvention
io.ebean.config.UnderscoreNamingConvention
- All Implemented Interfaces:
NamingConvention
Converts between Camel Case and Underscore based names for both table and
column names (and is the default naming convention in Ebean).
- Author:
- emcgreal, rbygrave
-
Field Summary
Fields inherited from class io.ebean.config.AbstractNamingConvention
databasePlatform, DEFAULT_SEQ_FORMAT, rhsPrefixLength, useForeignKeyPrefix -
Constructor Summary
ConstructorsConstructorDescriptionCreate with a sequence format of "{table}_seq".UnderscoreNamingConvention(String sequenceFormat) Create with a given sequence format. -
Method Summary
Modifier and TypeMethodDescriptiongetColumnFromProperty(Class<?> beanClass, String propertyName) Converts Camel case property name to underscore based column name.getForeignKey(String prefix, String fkProperty) Return the foreign key column given the local and foreign properties.getTableNameByConvention(Class<?> beanClass) Returns the last part of the class name.booleanReturns true if digits are compressed.booleanReturn true if the result will be upper case.voidsetDigitsCompressed(boolean digitsCompressed) Sets to true for digits to be compressed (without a leading underscore).voidsetForceUpperCase(boolean forceUpperCase) Set to true to make the result upper case.protected StringtoCamelFromUnderscore(String underscore) Convert and return the from string from underscore to camel case.protected StringtoUnderscoreFromCamel(String camelCase) Convert and return the string to underscore from camel case.Methods inherited from class io.ebean.config.AbstractNamingConvention
deriveM2MColumn, getCatalog, getM2MJoinTableName, getSchema, getSequenceFormat, getSequenceName, getTableName, getTableName, getTableNameFromAnnotation, hasInheritance, isEmpty, isUseForeignKeyPrefix, loadFromProperties, quoteIdentifiers, setCatalog, setDatabasePlatform, setSchema, setSequenceFormat, setUseForeignKeyPrefix
-
Constructor Details
-
UnderscoreNamingConvention
Create with a given sequence format.- Parameters:
sequenceFormat- the sequence format
-
UnderscoreNamingConvention
public UnderscoreNamingConvention()Create with a sequence format of "{table}_seq".
-
-
Method Details
-
getTableNameByConvention
Returns the last part of the class name.- Specified by:
getTableNameByConventionin classAbstractNamingConvention- Parameters:
beanClass- the bean class- Returns:
- the table name from class
-
getColumnFromProperty
Converts Camel case property name to underscore based column name.- Returns:
- the column from property
-
isForceUpperCase
public boolean isForceUpperCase()Return true if the result will be upper case.False if it will be lower case.
-
setForceUpperCase
public void setForceUpperCase(boolean forceUpperCase) Set to true to make the result upper case. -
isDigitsCompressed
public boolean isDigitsCompressed()Returns true if digits are compressed. -
setDigitsCompressed
public void setDigitsCompressed(boolean digitsCompressed) Sets to true for digits to be compressed (without a leading underscore). -
getForeignKey
Description copied from interface:NamingConventionReturn the foreign key column given the local and foreign properties.- Parameters:
prefix- the local column used to prefix the fk columnfkProperty- the property name of the foreign key- Returns:
- the foreign key column
-
toUnderscoreFromCamel
Convert and return the string to underscore from camel case. -
toCamelFromUnderscore
Convert and return the from string from underscore to camel case.
-