org.sqlproc.engine.impl
Class SqlType

java.lang.Object
  extended by org.sqlproc.engine.impl.SqlType

 class SqlType
extends java.lang.Object

The SQL type of a dynamic input value (SQL statement parameter) or an output value (SQL query scalar).

Author:
Vladimir Hudec

Field Summary
private  org.hibernate.type.Type hibernateType
          The Hibernate type.
(package private) static java.util.Map<java.lang.String,java.lang.reflect.Field> hibernateTypes
          The map between a String representation of Hibernate types and a Hibernate types.
(package private) static java.util.Map<java.lang.Class<?>,org.hibernate.type.Type> hibernateTypes2
          The map between an input/output Java types and a Hibernate types.
private  SqlMetaType metaType
          The internal type, which means special processing of the input/output value.
private  java.lang.String value
          Right now only for the special of the enumeration type of the input value.
 
Constructor Summary
SqlType()
          Creates a new instance with unspecified internal and Hibernate types.
SqlType(SqlMetaType metaType, org.hibernate.type.Type hibernateType)
          Creates a new instance with specified internal and Hibernate types.
SqlType(java.lang.String sHibernateType)
          Creates a new instance with specified Hibernate type.
SqlType(java.lang.String sMetaType, SqlType previousType)
          Creates a new instance with specified internal type.
 
Method Summary
(package private)  org.hibernate.type.Type getHibernateType()
          Returns the Hibernate type.
(package private)  org.hibernate.type.Type getHibernateType(java.lang.Class<?> pojoClass, java.lang.String attributeName)
          Returns the Hibernate type of the attribute in the target pojoClass.
(package private)  SqlMetaType getMetaType()
          Returns the internal type.
 java.lang.String getValue()
          Returns the value.
(package private)  void setParameter(org.hibernate.Query query, java.lang.String paramName, java.lang.Object inputValue)
          Bind an input value to a named query parameter.
(package private)  void setResult(java.lang.Object resultInstance, java.lang.String attributeName, java.lang.Object resultValue)
          Initializes the attribute of the result class with output values from SQL query execution.
 void setValue(java.lang.String value)
          Sets the value.
 java.lang.String toString()
          For debug purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

metaType

private SqlMetaType metaType
The internal type, which means special processing of the input/output value.


hibernateType

private org.hibernate.type.Type hibernateType
The Hibernate type. A standard way to assing the type of parameter/scalar binding to the Hibernate Query.


value

private java.lang.String value
Right now only for the special of the enumeration type of the input value. The logical evaluation of the input value is based on the comparison to this value.


hibernateTypes

static java.util.Map<java.lang.String,java.lang.reflect.Field> hibernateTypes
The map between a String representation of Hibernate types and a Hibernate types.


hibernateTypes2

static java.util.Map<java.lang.Class<?>,org.hibernate.type.Type> hibernateTypes2
The map between an input/output Java types and a Hibernate types.

Constructor Detail

SqlType

SqlType()
Creates a new instance with unspecified internal and Hibernate types.


SqlType

SqlType(SqlMetaType metaType,
        org.hibernate.type.Type hibernateType)
Creates a new instance with specified internal and Hibernate types.

Parameters:
metaType - the internal type
hibernateType - the Hibernate type

SqlType

SqlType(java.lang.String sHibernateType)
Creates a new instance with specified Hibernate type.

Parameters:
sHibernateType - the String representation of the Hibernate type

SqlType

SqlType(java.lang.String sMetaType,
        SqlType previousType)
Creates a new instance with specified internal type.

Parameters:
sMetaType - the String representation of the internal type
previousType - the prevoius value of the input/output value type
Method Detail

getHibernateType

org.hibernate.type.Type getHibernateType()
Returns the Hibernate type.

Returns:
the Hibernate type

getHibernateType

org.hibernate.type.Type getHibernateType(java.lang.Class<?> pojoClass,
                                         java.lang.String attributeName)
Returns the Hibernate type of the attribute in the target pojoClass.

Parameters:
pojoClass - the target class
attributeName - the name of the attribute in the target pojoClass
Returns:
the Hibernate type

getMetaType

SqlMetaType getMetaType()
Returns the internal type.

Returns:
the internal type

setResult

void setResult(java.lang.Object resultInstance,
               java.lang.String attributeName,
               java.lang.Object resultValue)
Initializes the attribute of the result class with output values from SQL query execution.

Parameters:
resultInstance - the instance of the result class
attributeName - the name of the attribute in the result class
resultValue - Query execution output value

setParameter

void setParameter(org.hibernate.Query query,
                  java.lang.String paramName,
                  java.lang.Object inputValue)
Bind an input value to a named query parameter.

Parameters:
query - the object-oriented representation of a Hibernate query
paramName - the name of the parameter
inputValue - the possibly-null parameter value, a dynamic input value

getValue

public java.lang.String getValue()
Returns the value. Right now only for the special of the enumeration type of the input value. The logical evaluation of the input value is based on the comparison to this value.

Returns:
the value for special enumeration treatment

setValue

public void setValue(java.lang.String value)
Sets the value. Right now only for the special of the enumeration type of the input value. The logical evaluation of the input value is based on the comparison to this value.

Parameters:
value - the value for special enumeration treatment

toString

public java.lang.String toString()
For debug purposes.

Overrides:
toString in class java.lang.Object
Returns:
a String representation for a debug output


Copyright © 2010. All Rights Reserved.