|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Creates types.
Any implementation of SaffronTypeFactory
must ensure that
types are canonical: two types are equal if and only if they are the same
object.
Nested Class Summary | |
static interface |
SaffronTypeFactory.FieldInfo
Callback which provides enough information to create fields. |
Method Summary | |
SaffronType |
createJavaType(Class clazz)
Creates a type which encapsulates a Java class. |
SaffronType |
createJoinType(SaffronType[] types)
Creates a cartesian product type. |
SaffronType |
createProjectType(SaffronType[] types,
String[] fieldNames)
Creates a type which represents a projection of a set of fields. |
SaffronType |
createProjectType(SaffronTypeFactory.FieldInfo fieldInfo)
Creates a type which represents a projection of a set fields, getting the field informatation from a callback. |
SaffronTypeFactoryImpl.SqlType |
createSqlType(SqlTypeName typeName)
Creates a SQL type with no precision or scale. |
SaffronTypeFactoryImpl.SqlType |
createSqlType(SqlTypeName typeName,
int length)
Creates a SQL type with length (precision) but no scale. |
SaffronTypeFactoryImpl.SqlType |
createSqlType(SqlTypeName typeName,
int length,
int scale)
Creates a SQL type with length (precision) and scale. |
SaffronType |
createTypeWithNullability(SaffronType type,
boolean nullable)
Creates a Type which is the same as another type but with possibily different nullability. |
SaffronType |
leastRestrictive(SaffronType[] types)
Returns the most general of a set of types (that is, one type to which they can all be cast), or null if conversion is not possible. |
Method Detail |
public SaffronType createJavaType(Class clazz)
public SaffronType createJoinType(SaffronType[] types)
public SaffronType createProjectType(SaffronType[] types, String[] fieldNames)
The return is canonical: if an equivalent type already exists, it is returned.
types
- Types of the fieldsfieldNames
- Names of the fields
public SaffronType createProjectType(SaffronTypeFactory.FieldInfo fieldInfo)
public SaffronType createTypeWithNullability(SaffronType type, boolean nullable)
type
- input typenullable
- true to request a nullable type; false to request a
NOT NULL type
public SaffronType leastRestrictive(SaffronType[] types)
public SaffronTypeFactoryImpl.SqlType createSqlType(SqlTypeName typeName)
typeName
- Name of the type, for example
SqlTypeName.Boolean
.
public SaffronTypeFactoryImpl.SqlType createSqlType(SqlTypeName typeName, int length)
typeName
- Name of the type, for example
SqlTypeName.Varchar
.length
- Maximum length of the value (non-numeric types)
or the precision of the value (numeric types)
public SaffronTypeFactoryImpl.SqlType createSqlType(SqlTypeName typeName, int length, int scale)
typeName
- Name of the type, for example
SqlTypeName.Varchar
.length
- Maximum length of the value (non-numeric types)
or the precision of the value (numeric types)scale
- Scale of the values. The number of decimal places to shift
the value. For example, a NUMBER(10,3) value of "123.45" is
represented "123450" (that is, multiplied by 10^3). A negative scale
is valid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |