public class DefaultNamingStrategy extends Object implements NamingStrategy, Serializable
a better alternative
,
Serialized FormModifier and Type | Field and Description |
---|---|
static NamingStrategy |
INSTANCE
The singleton instance
|
Constructor and Description |
---|
DefaultNamingStrategy() |
Modifier and Type | Method and Description |
---|---|
String |
classToTableName(String className)
Return the unqualified class name
|
String |
collectionTableName(String ownerEntity,
String ownerEntityTable,
String associatedEntity,
String associatedEntityTable,
String propertyName)
Return the unqualified property name, not the best strategy but a backward compatible one
|
String |
columnName(String columnName)
Return the argument
|
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 unqualified property name
|
String |
tableName(String tableName)
Return the argument
|
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)
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 © 2001-2015 Red Hat, Inc. All Rights Reserved.