org.sqlproc.engine.type
Class SqlComposedTypeFactory

java.lang.Object
  extended by 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 the SqlMetaType instances. 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 of SqlProcessorLoader construction.

Author:
Vladimir Hudec

Field Summary
private  Map<Class<?>,SqlMetaType> classToTypeMap
          The map between a Java class type and an internal type.
private  Map<String,SqlMetaType> metaToTypeMap
          The map between a String representation of an internal type and an internal type.
private  SqlTypeFactory typeFactory
          The factory of the underlying stack.
 
Constructor Summary
SqlComposedTypeFactory(SqlTypeFactory typeFactory)
          Creates a new instance of this factory.
SqlComposedTypeFactory(SqlTypeFactory typeFactory, List<SqlInternalType> customTypes)
          Creates a new instance of this factory.
 
Method Summary
 SqlMetaType[] getAllTypes()
          Returns the collection of all the META types provided by this factory.
 SqlMetaType getDefaultType()
          Returns the default META type.
 SqlMetaType getEnumIntegerType()
          Returns the META type for the enumerations based on Integer internal type.
 SqlMetaType getEnumStringType()
          Returns the META type for the enumerations based on String internal type.
 SqlMetaType getIdentityType()
          Returns the META type for an auto-generated identity.
 SqlMetaType getMetaType(Class<?> clazz)
          Returns the META type, which can be used to handle input/output values of provided Java type.
 SqlMetaType getMetaType(String name)
          Returns the META type with the provided name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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<SqlInternalType> customTypes)
Creates a new instance of this factory.

Parameters:
typeFactory - the factory of the underlying stack
customTypes - 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:
getDefaultType in interface SqlTypeFactory
Returns:
the default META type

getEnumIntegerType

public SqlMetaType getEnumIntegerType()
Returns the META type for the enumerations based on Integer internal type.

Specified by:
getEnumIntegerType in interface SqlTypeFactory
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:
getEnumStringType in interface SqlTypeFactory
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:
getIdentityType in interface SqlTypeFactory
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:
getAllTypes in interface SqlTypeFactory
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:
getMetaType in interface SqlTypeFactory
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:
getMetaType in interface SqlTypeFactory
Parameters:
name - the name of the META SQL type
Returns:
the META type


Copyright © 2015. All rights reserved.