Package org.sqlproc.engine.type
Class SqlComposedTypeFactory
- java.lang.Object
-
- org.sqlproc.engine.type.SqlComposedTypeFactory
-
- All Implemented Interfaces:
SqlTypeFactory
public class SqlComposedTypeFactory extends Object implements SqlTypeFactory
The factory definition, which can be used to construct theSqlMetaTypeinstances. It's used to combine the factory of the underlying stack (on top of which the SQL Processor works) and the custom META types provided in the time ofSqlProcessorLoaderconstruction.- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description private Map<Class<?>,SqlMetaType>classToTypeMapThe map between a Java class type and an internal type.private Map<String,SqlMetaType>metaToTypeMapThe map between a String representation of an internal type and an internal type.private SqlTypeFactorytypeFactoryThe factory of the underlying stack.
-
Constructor Summary
Constructors Constructor Description SqlComposedTypeFactory(SqlTypeFactory typeFactory)Creates a new instance of this factory.SqlComposedTypeFactory(SqlTypeFactory typeFactory, List<SqlMetaType> customTypes)Creates a new instance of this factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlMetaType[]getAllTypes()Returns the collection of all the META types provided by this factory.SqlMetaTypegetDefaultType()Returns the default META type.SqlMetaTypegetEnumIntegerType()Returns the META type for the enumerations based on Integer internal type.SqlMetaTypegetEnumStringType()Returns the META type for the enumerations based on String internal type.SqlMetaTypegetIdentityType()Returns the META type for an auto-generated identity.SqlMetaTypegetMetaType(Class<?> clazz)Returns the META type, which can be used to handle input/output values of provided Java type.SqlMetaTypegetMetaType(String name)Returns the META type with the provided name.
-
-
-
Field Detail
-
classToTypeMap
private Map<Class<?>,SqlMetaType> classToTypeMap
The map between a Java class type and an internal type.
-
metaToTypeMap
private Map<String,SqlMetaType> metaToTypeMap
The map between a String representation of an internal type and an internal type.
-
typeFactory
private SqlTypeFactory typeFactory
The factory of the underlying stack.
-
-
Constructor Detail
-
SqlComposedTypeFactory
public SqlComposedTypeFactory(SqlTypeFactory typeFactory)
Creates a new instance of this factory.- Parameters:
typeFactory- the factory of the underlying stack
-
SqlComposedTypeFactory
public SqlComposedTypeFactory(SqlTypeFactory typeFactory, List<SqlMetaType> customTypes)
Creates a new instance of this factory.- Parameters:
typeFactory- the factory of the underlying stackcustomTypes- a collection of the custom META types provided by an user
-
-
Method Detail
-
getDefaultType
public SqlMetaType getDefaultType()
Returns the default META type. It's used in the case there's no explicit META type declaration in the META SQL statements.- Specified by:
getDefaultTypein interfaceSqlTypeFactory- Returns:
- the default META type
-
getEnumIntegerType
public SqlMetaType getEnumIntegerType()
Returns the META type for the enumerations based on Integer internal type.- Specified by:
getEnumIntegerTypein interfaceSqlTypeFactory- Returns:
- the META type for the enumerations based on Integer internal type
-
getEnumStringType
public SqlMetaType getEnumStringType()
Returns the META type for the enumerations based on String internal type.- Specified by:
getEnumStringTypein interfaceSqlTypeFactory- Returns:
- the META type for the enumerations based on String internal type
-
getIdentityType
public SqlMetaType getIdentityType()
Returns the META type for an auto-generated identity.- Specified by:
getIdentityTypein interfaceSqlTypeFactory- Returns:
- the META type for an auto-generated identity
-
getAllTypes
public SqlMetaType[] getAllTypes()
Returns the collection of all the META types provided by this factory.- Specified by:
getAllTypesin interfaceSqlTypeFactory- Returns:
- the collection of all the META types
-
getMetaType
public SqlMetaType getMetaType(Class<?> clazz)
Returns the META type, which can be used to handle input/output values of provided Java type.- Specified by:
getMetaTypein interfaceSqlTypeFactory- Parameters:
clazz- the input/output value Java type- Returns:
- the META type
-
getMetaType
public SqlMetaType getMetaType(String name)
Returns the META type with the provided name.- Specified by:
getMetaTypein interfaceSqlTypeFactory- Parameters:
name- the name of the META SQL type- Returns:
- the META type
-
-