public class ImprovedNamingStrategy extends Object implements NamingStrategy, Serializable
the default strategy
,
Serialized FormModifier and Type | Field and Description |
---|---|
static NamingStrategy |
INSTANCE
A convenient singleton instance
|
Constructor and Description |
---|
ImprovedNamingStrategy() |
Modifier and Type | Method and Description |
---|---|
protected static String |
addUnderscores(String name) |
String |
classToTableName(String className)
Return the unqualified class name, mixed case converted to
underscores
|
String |
collectionTableName(String ownerEntity,
String ownerEntityTable,
String associatedEntity,
String associatedEntityTable,
String propertyName)
Return a collection table name ie an association having a join table
|
String |
columnName(String columnName)
Convert mixed case to underscores
|
String |
foreignKeyColumnName(String propertyName,
String propertyEntityName,
String propertyTableName,
String referencedColumnName)
Return the property name or propertyTableName
|
String |
joinKeyColumnName(String joinedColumn,
String joinedTable)
Return the argument
|
String |
logicalCollectionColumnName(String columnName,
String propertyName,
String referencedColumn)
Return the column name if explicit or the concatenation of the property name and the referenced column
|
String |
logicalCollectionTableName(String tableName,
String ownerEntityTable,
String associatedEntityTable,
String propertyName)
Returns either the table name if explicit or
if there is an associated table, the concatenation of owner entity table and associated table
otherwise the concatenation of owner entity table and the unqualified property name
|
String |
logicalColumnName(String columnName,
String propertyName)
Return the column name or the unqualified property name
|
String |
propertyToColumnName(String propertyName)
Return the full property path with underscore seperators, mixed
case converted to underscores
|
String |
tableName(String tableName)
Convert mixed case to underscores
|
public static final NamingStrategy INSTANCE
public String classToTableName(String className)
classToTableName
in interface NamingStrategy
className
- the fully-qualified class namepublic String propertyToColumnName(String propertyName)
propertyToColumnName
in interface NamingStrategy
propertyName
- a property pathpublic String tableName(String tableName)
tableName
in interface NamingStrategy
tableName
- a table namepublic String columnName(String columnName)
columnName
in interface NamingStrategy
columnName
- a column namepublic String collectionTableName(String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, String propertyName)
NamingStrategy
collectionTableName
in interface NamingStrategy
ownerEntityTable
- owner side table nameassociatedEntityTable
- reverse side table name if anypropertyName
- collection rolepublic String joinKeyColumnName(String joinedColumn, String joinedTable)
joinKeyColumnName
in interface NamingStrategy
joinedColumn
- joined column name (logical one) used to join withjoinedTable
- joined table name (ie the referenced table) used to join withpublic String foreignKeyColumnName(String propertyName, String propertyEntityName, String propertyTableName, String referencedColumnName)
foreignKeyColumnName
in interface NamingStrategy
propertyName
- the property name involvedpropertyTableName
- the property table name involved (logical one)referencedColumnName
- the referenced column name involved (logical one)public String logicalColumnName(String columnName, String propertyName)
logicalColumnName
in interface NamingStrategy
columnName
- given column name if anypropertyName
- property name of this columnpublic String logicalCollectionTableName(String tableName, String ownerEntityTable, String associatedEntityTable, String propertyName)
logicalCollectionTableName
in interface NamingStrategy
tableName
- the metadata explicit nameownerEntityTable
- owner table entity table name (logical one)associatedEntityTable
- reverse side table name if any (logical one)propertyName
- collection rolepublic String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn)
logicalCollectionColumnName
in interface NamingStrategy
columnName
- given column name in the metadata if anypropertyName
- property namereferencedColumn
- referenced column name (logical one) in the joinCopyright © 2017 JBoss by Red Hat. All rights reserved.