|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.triactive.jdo.store.sql.SqlIdentifier
com.triactive.jdo.store.sql.ColumnName
An SQL column name.
A ColumnName is mostly just an SqlIdentifier
subclassed for type
safety.
Column names in TJDO are generated using a suffix convention based on their
"role".
The inRole(com.triactive.jdo.store.sql.Role, java.lang.Class)
method is used to add role suffixes.
The role disambiguates columns in some situations where two columns would
otherwise have the same name.
For example, a Map table names its columns according to data type.
A Map whose key and value are both of type String would produce columns named
STRING_KEY and STRING_VAL.
Field Summary | |
static int |
MAX_SUFFIX_LENGTH
The maximum length in characters reserved at the end of column names for suffixes used to indicate a column's role (such as _ID for an ID column). |
Fields inherited from class com.triactive.jdo.store.sql.SqlIdentifier |
dba, fullName, name |
Constructor Summary | |
ColumnName(DatabaseAdapter dba,
java.lang.String identifier)
Constructs a column name. |
Method Summary | |
static ColumnName |
fromJavaName(DatabaseAdapter dba,
java.lang.String javaName)
Converts a Java name string to an SQL column name. |
ColumnName |
inRole(Role role,
java.lang.Class javaType)
Returns a new column name equal to this column name plus a role suffix. |
Methods inherited from class com.triactive.jdo.store.sql.SqlIdentifier |
compareTo, equals, hashCode, intern, isKeyword, javaToSql, toString, undelimited, untruncated |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static int MAX_SUFFIX_LENGTH
Constructor Detail |
public ColumnName(DatabaseAdapter dba, java.lang.String identifier)
dba
- a database adapter for the relevant databaseidentifier
- the SQL identifier value as a stringMethod Detail |
public ColumnName inRole(Role role, java.lang.Class javaType)
The column name identifier is first truncated if necessary to reserve
MAX_SUFFIX_LENGTH
characters for a suffix.
Then a suitable suffix is appended based on the column's role
and javaType.
role
- The column's role.javaType
- The Java type of the data stored in the column.
Role.getSqlIdentifierSuffix(com.triactive.jdo.store.adapter.DatabaseAdapter, java.lang.Class)
public static ColumnName fromJavaName(DatabaseAdapter dba, java.lang.String javaName)
dba
- a database adapter for the relevant databasejavaName
- the Java identifier name. Must not be null.
SqlIdentifier.javaToSql(java.lang.String)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |