|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.modello.generator.database.type.Types
public class Types
Manages the set of types supported by a database provider, and the mappings from standard JDBC types to the provider types.
| Constructor Summary | |
|---|---|
Types()
Construct a new empty Types |
|
| Method Summary | |
|---|---|
void |
addAutoIncrementMapping(Mapping mapping)
Add an auto-increment mapping. |
void |
addMapping(Mapping mapping)
Add a mapping. |
void |
addType(Type type)
Add a type. |
TypeMapping |
getAutoIncrementMapping(java.lang.String name,
long size)
Returns the closest auto-increment type mapping matching the requested type name and size |
java.util.List |
getAutoIncrementMappings()
Returns all auto-increment mappings |
java.util.List |
getMappings()
Returns all mappings that the database supports |
java.lang.String |
getSQLType(Column column)
Helper to return the SQL type for a column |
Type |
getType(java.lang.String sqlName)
Returns a type, based on its name |
protected TypeMapping |
getTypeMapping(java.util.List mappings,
long size)
Returns the closest type mapping for a requested size, from a list of Mappings. |
TypeMapping |
getTypeMapping(java.lang.String name,
long size)
Returns the first type matching the requested type name and size |
java.util.List |
getTypes()
Returns all types |
TypeMapping |
promote(java.lang.String name,
long size)
Promote a type to that supported by the database provider. |
protected TypeMapping |
promote(java.lang.String name,
long size,
java.lang.String[] types)
Promote a type to that supported by the database provider. |
protected TypeMapping |
promote(java.lang.String name,
long size,
java.lang.String[] types,
java.lang.String defaultName)
Promote a type to that supported by the database provider. |
TypeMapping |
promote(java.lang.String fromName,
java.lang.String toName,
long size)
Promote a type to another type |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Types()
Types
| Method Detail |
|---|
public java.util.List getTypes()
public Type getType(java.lang.String sqlName)
sqlName - the name of the type
sqlName, or
null if no such type existspublic void addType(Type type)
Type.getSQLName() - if a type already exists with the same
name, it will be replaced
public java.util.List getMappings()
public void addMapping(Mapping mapping)
Mapping.getName().
Multiple mappings can be added with the same name.
java.lang.IllegalArgumentException - if no there is no corresponding
Type registered for Mapping.getSQLName()public java.util.List getAutoIncrementMappings()
public void addAutoIncrementMapping(Mapping mapping)
Mapping.getName(). Multiple mappings can be added with the same
name.
java.lang.IllegalArgumentException - if no there is no corresponding
Type registered for Mapping.getSQLName()
public TypeMapping getTypeMapping(java.lang.String name,
long size)
name - the JDBC type namesize - the requested size. A size of 0 indicates that the type
has no size
null if none exists
public TypeMapping getAutoIncrementMapping(java.lang.String name,
long size)
name - the JDBC type namesize - the requested size. A size <= 0 indicates that the type
has no size
null if none
exists
public TypeMapping promote(java.lang.String name,
long size)
name - the JDBC type namesize - the requested size
null if the type
can't be promoted
public TypeMapping promote(java.lang.String fromName,
java.lang.String toName,
long size)
fromName - the JDBC type name to promotetoName - the JDBC type name to promote tosize - the requested size
null if the
promotion is invalid, or isn't supported by the database providerpublic java.lang.String getSQLType(Column column)
column - the column
column
protected TypeMapping getTypeMapping(java.util.List mappings,
long size)
Mappings.
Note that the returned mapping may specify a size less than that
requested.
mappings - a list of Mappingssize - the requested size
protected TypeMapping promote(java.lang.String name,
long size,
java.lang.String[] types)
name - the JDBC type namesize - the requested sizetypes - the set of JDBC types that name may be
promoted to
null if the type
can't be promoted
protected TypeMapping promote(java.lang.String name,
long size,
java.lang.String[] types,
java.lang.String defaultName)
name - the JDBC type namesize - the requested sizetypes - the set of JDBC types that name may be
promoted todefaultName - the default type name to promote to. If non-null,
this is used in preference to those listed by types
null if the type
can't be promoted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||