public class ImprovedNamingStrategy extends java.lang.Object implements NamingStrategy, java.io.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 java.lang.String |
addUnderscores(java.lang.String name) |
java.lang.String |
classToTableName(java.lang.String className)
Return the unqualified class name, mixed case converted to
underscores
|
java.lang.String |
collectionTableName(java.lang.String ownerEntity,
java.lang.String ownerEntityTable,
java.lang.String associatedEntity,
java.lang.String associatedEntityTable,
java.lang.String propertyName)
Return a collection table name ie an association having a join table
|
java.lang.String |
columnName(java.lang.String columnName)
Convert mixed case to underscores
|
java.lang.String |
foreignKeyColumnName(java.lang.String propertyName,
java.lang.String propertyEntityName,
java.lang.String propertyTableName,
java.lang.String referencedColumnName)
Return the property name or propertyTableName
|
java.lang.String |
joinKeyColumnName(java.lang.String joinedColumn,
java.lang.String joinedTable)
Return the argument
|
java.lang.String |
logicalCollectionColumnName(java.lang.String columnName,
java.lang.String propertyName,
java.lang.String referencedColumn)
Return the column name if explicit or the concatenation of the property name and the referenced column
|
java.lang.String |
logicalCollectionTableName(java.lang.String tableName,
java.lang.String ownerEntityTable,
java.lang.String associatedEntityTable,
java.lang.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
|
java.lang.String |
logicalColumnName(java.lang.String columnName,
java.lang.String propertyName)
Return the column name or the unqualified property name
|
java.lang.String |
propertyToColumnName(java.lang.String propertyName)
Return the full property path with underscore seperators, mixed
case converted to underscores
|
java.lang.String |
tableName(java.lang.String tableName)
Convert mixed case to underscores
|
public static final NamingStrategy INSTANCE
public java.lang.String classToTableName(java.lang.String className)
classToTableName
in interface NamingStrategy
className
- the fully-qualified class namepublic java.lang.String propertyToColumnName(java.lang.String propertyName)
propertyToColumnName
in interface NamingStrategy
propertyName
- a property pathpublic java.lang.String tableName(java.lang.String tableName)
tableName
in interface NamingStrategy
tableName
- a table namepublic java.lang.String columnName(java.lang.String columnName)
columnName
in interface NamingStrategy
columnName
- a column nameprotected static java.lang.String addUnderscores(java.lang.String name)
public java.lang.String collectionTableName(java.lang.String ownerEntity, java.lang.String ownerEntityTable, java.lang.String associatedEntity, java.lang.String associatedEntityTable, java.lang.String propertyName)
NamingStrategy
collectionTableName
in interface NamingStrategy
ownerEntityTable
- owner side table nameassociatedEntityTable
- reverse side table name if anypropertyName
- collection rolepublic java.lang.String joinKeyColumnName(java.lang.String joinedColumn, java.lang.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 java.lang.String foreignKeyColumnName(java.lang.String propertyName, java.lang.String propertyEntityName, java.lang.String propertyTableName, java.lang.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 java.lang.String logicalColumnName(java.lang.String columnName, java.lang.String propertyName)
logicalColumnName
in interface NamingStrategy
columnName
- given column name if anypropertyName
- property name of this columnpublic java.lang.String logicalCollectionTableName(java.lang.String tableName, java.lang.String ownerEntityTable, java.lang.String associatedEntityTable, java.lang.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 java.lang.String logicalCollectionColumnName(java.lang.String columnName, java.lang.String propertyName, java.lang.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 © 2001-2018 Red Hat, Inc. All Rights Reserved.