Methods Summary |
---|
protected static java.lang.String | addUnderscores(java.lang.String name)
StringBuffer buf = new StringBuffer( name.replace('.", '_") );
for (int i=1; i<buf.length()-1; i++) {
if (
Character.isLowerCase( buf.charAt(i-1) ) &&
Character.isUpperCase( buf.charAt(i) ) &&
Character.isLowerCase( buf.charAt(i+1) )
) {
buf.insert(i++, '_");
}
}
return buf.toString().toLowerCase();
|
public java.lang.String | classToTableName(java.lang.String className)Return the unqualified class name, mixed case converted to
underscores
return addUnderscores( StringHelper.unqualify(className) );
|
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)
return tableName( ownerEntityTable + '_" + propertyToColumnName(propertyName) );
|
public java.lang.String | columnName(java.lang.String columnName)Convert mixed case to underscores
return addUnderscores(columnName);
|
public 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
String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName;
if (header == null) throw new AssertionFailure("NamingStrategy not properly filled");
return columnName( header ); //+ "_" + referencedColumnName not used for backward compatibility
|
public java.lang.String | joinKeyColumnName(java.lang.String joinedColumn, java.lang.String joinedTable)Return the argument
return columnName( joinedColumn );
|
public 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
return StringHelper.isNotEmpty( columnName ) ?
columnName :
StringHelper.unqualify( propertyName ) + "_" + referencedColumn;
|
public 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
if ( tableName != null ) {
return tableName;
}
else {
//use of a stringbuffer to workaround a JDK bug
return new StringBuffer(ownerEntityTable).append("_")
.append(
associatedEntityTable != null ?
associatedEntityTable :
StringHelper.unqualify( propertyName )
).toString();
}
|
public java.lang.String | logicalColumnName(java.lang.String columnName, java.lang.String propertyName)Return the column name or the unqualified property name
return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName );
|
public java.lang.String | propertyToColumnName(java.lang.String propertyName)Return the full property path with underscore seperators, mixed
case converted to underscores
return addUnderscores( StringHelper.unqualify(propertyName) );
|
public java.lang.String | tableName(java.lang.String tableName)Convert mixed case to underscores
return addUnderscores(tableName);
|