jodd.db.oom.naming
Class TableNamingStrategy

java.lang.Object
  extended by jodd.db.oom.naming.TableNamingStrategy

public class TableNamingStrategy
extends java.lang.Object

Naming strategy for converting entity names (i.e. class names) to database table names.


Field Summary
protected  boolean changeCase
           
protected  char entityNameTerminator
           
protected  java.lang.String prefix
           
protected  char separatorChar
           
protected  boolean splitCamelCase
           
protected  java.lang.String suffix
           
protected  boolean uppercase
           
 
Constructor Summary
TableNamingStrategy()
           
 
Method Summary
 java.lang.String convertEntityNameToTableName(java.lang.Class type)
          Converts entity name to table name.
 java.lang.String convertEntityNameToTableName(java.lang.String entityName)
          Converts entity (type) name to table name.
 java.lang.String convertTableNameToEntityName(java.lang.String tableName)
          Converts table name to entity (type) name.
 char getEntityNameTerminator()
           
 java.lang.String getPrefix()
           
 char getSeparatorChar()
           
 java.lang.String getSuffix()
           
 boolean isChangeCase()
           
 boolean isLowercase()
           
 boolean isSplitCamelCase()
           
 boolean isUppercase()
           
 void setChangeCase(boolean changeCase)
          Specifies if database names should be convert to uppercase or lowercase.
 void setEntityNameTerminator(char entityNameTerminator)
          Specifies the terminator character for entity names.
 void setLowercase(boolean lowercase)
          Alternative property to setUppercase(boolean).
 void setPrefix(java.lang.String prefix)
          Table prefix, may be null.
 void setSeparatorChar(char separatorChar)
          Separator character, when camel case names are split.
 void setSplitCamelCase(boolean splitCamelCase)
          Specifies if camel case name has to be split.
 void setSuffix(java.lang.String suffix)
          Table suffix, may be null.
 void setUppercase(boolean uppercase)
          Specifies if table name should be converted to uppercase.
protected static java.lang.StringBuilder toLowercase(java.lang.StringBuilder string)
           
protected static java.lang.StringBuilder toUppercase(java.lang.StringBuilder string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

protected java.lang.String prefix

suffix

protected java.lang.String suffix

entityNameTerminator

protected char entityNameTerminator

splitCamelCase

protected boolean splitCamelCase

separatorChar

protected char separatorChar

changeCase

protected boolean changeCase

uppercase

protected boolean uppercase
Constructor Detail

TableNamingStrategy

public TableNamingStrategy()
Method Detail

getPrefix

public java.lang.String getPrefix()

setPrefix

public void setPrefix(java.lang.String prefix)
Table prefix, may be null.


getSuffix

public java.lang.String getSuffix()

setSuffix

public void setSuffix(java.lang.String suffix)
Table suffix, may be null.


getEntityNameTerminator

public char getEntityNameTerminator()

setEntityNameTerminator

public void setEntityNameTerminator(char entityNameTerminator)
Specifies the terminator character for entity names. When some type is proxified, new class name usually contains some special character, like '$'.


convertEntityNameToTableName

public java.lang.String convertEntityNameToTableName(java.lang.Class type)
Converts entity name to table name.

See Also:
convertEntityNameToTableName(String)

convertEntityNameToTableName

public java.lang.String convertEntityNameToTableName(java.lang.String entityName)
Converts entity (type) name to table name.


convertTableNameToEntityName

public java.lang.String convertTableNameToEntityName(java.lang.String tableName)
Converts table name to entity (type) name.


isSplitCamelCase

public boolean isSplitCamelCase()

setSplitCamelCase

public void setSplitCamelCase(boolean splitCamelCase)
Specifies if camel case name has to be split. If set to false, then name is passed unchanged.


getSeparatorChar

public char getSeparatorChar()

setSeparatorChar

public void setSeparatorChar(char separatorChar)
Separator character, when camel case names are split.


isChangeCase

public boolean isChangeCase()

setChangeCase

public void setChangeCase(boolean changeCase)
Specifies if database names should be convert to uppercase or lowercase.


isUppercase

public boolean isUppercase()

setUppercase

public void setUppercase(boolean uppercase)
Specifies if table name should be converted to uppercase. Table names includes prefix and suffix. Otherwise, table name will be converted to lowercase.


isLowercase

public boolean isLowercase()

setLowercase

public void setLowercase(boolean lowercase)
Alternative property to setUppercase(boolean). Does just opposite.


toUppercase

protected static java.lang.StringBuilder toUppercase(java.lang.StringBuilder string)

toLowercase

protected static java.lang.StringBuilder toLowercase(java.lang.StringBuilder string)


Copyright © 2003-2012 Jodd Team