All Packages    This Package  Previous  Next  

Class sqlj.runtime.profile.TypeInfo

java.lang.Object
   |
   +----sqlj.runtime.profile.TypeInfo

public abstract class TypeInfo
extends Object
implements Serializable, ObjectInputValidation
A TypeInfo object describes the type of a parameter passed to a sql operation or column of a ResultSet produced by a sql operation. The type consists of the java type of the actual Java expression which appears in the original source file, its corrsponding jdbc sql type, the name of the variable or column producing the type (if available), and its modality.

See Also:
getJavaType

Variable Index

 o IN
IN parameter mode, same value as DatabaseMetaData.procedureColumnIn.
 o INOUT
INOUT parameter mode, same value as DatabaseMetaData.procedureColumnInOut.
 o OUT
OUT parameter mode, same value as DatabaseMetaData.procedureColumnOut.

Constructor Index

 o TypeInfo()

Method Index

 o getJavaTypeName()
Returns the name of the Java Class representation of the type.
 o getMarkerIndex()
Returns the 0-based index of the '?' marker for this parameter in the sql string.
 o getMode()
Returns the modality of this parameter.
 o getName()
Returns the name of the variable or column producing this type.
 o getSQLType()
Returns the default mapping of this type as a SQL type, as defined in java.sql.Types.
 o isValidMode(int)
Returns true if the passed int parameter represents a valid mode type, false otherwise.
 o isValidSQLType(int)
Returns true if the passed int parameter represents a valid sql type, false otherwise.
 o modeToString(int)
Returns a string representation of a mode constant.
 o SQLTypeToString(int)
Returns a string representation of a sql type constant.
 o validateObject()
Performs validation on the internal state of this type info object.

Variables

 o IN
 public static final int IN
IN parameter mode, same value as DatabaseMetaData.procedureColumnIn.

See Also:
procedureColumnIn
 o OUT
 public static final int OUT
OUT parameter mode, same value as DatabaseMetaData.procedureColumnOut.

See Also:
procedureColumnOut
 o INOUT
 public static final int INOUT
INOUT parameter mode, same value as DatabaseMetaData.procedureColumnInOut.

See Also:
procedureColumnInOut

Constructors

 o TypeInfo
 public TypeInfo()

Methods

 o getJavaTypeName
 public abstract String getJavaTypeName()
Returns the name of the Java Class representation of the type. Each type appears in the original source file as a Java expression (variable) or cursor column whose type can be determined at compile time. This name may be used to determine an appropriate JDBC mapping into a SQL type.

Some customizations may find it most conveniant to work with type names, while others will need to query the reflection of complete classes. The getJavaType of a profile can be used to create a class reflection from a type info object. One benefit of using this method over getJavaType is that this method is guaranteed to succeed, while getJavaType may result in a NoClassDefFoundError if the classes in question have not been distributed with the profile.

In most cases, the name returned is the same as the result of calling profile.getJavaTye(type).getName(); primitive types have their simple names (e.g. int), classes are fully qualified (e.g. java.sql.Date), and nested classes are delimited with '$' (e.g. x.y.OuterClass$InnerClass). However, array naming does not follow the conventions of Class.getName(). If the name returned represents an array, the string "[" is prepended to the full name of the component type. For example, an array of array of String would have the name [[java.lang.String.

Returns:
the name of the Java Class representation of the type.
See Also:
getJavaType
 o getSQLType
 public abstract int getSQLType()
Returns the default mapping of this type as a SQL type, as defined in java.sql.Types. The Java Class represented by this type is mapped into a SQL type as defined by the JDBC default mappings. In the case that the JDBC specification defines a mapping from Java type into SQL type, that mapping is used. For example, if the Java class is Double, Types.DOUBLE is returned. If no JDBC recommended conversion exists for the class specified, Types.OTHER is returned. Profile customizations can be used to properly handle classes which would otherwise not be recognized by default JDBC mappings. They may also be used to override the default mappings.

Default conversions are described in the JDBC specification, sections 8.6.2 and 8.6.4

Returns:
the default mapping of this type as a SQL type.
See Also:
Types
 o isValidSQLType
 public static boolean isValidSQLType(int sqlType)
Returns true if the passed int parameter represents a valid sql type, false otherwise. Valid sql type values are those constants which are defined in the class java.sql.Types. Note that vendors may define their own sql types in addition to those found in java.sql.Types. In such cases, this method will return false.

See Also:
getSQLType, Types
 o SQLTypeToString
 public static String SQLTypeToString(int sqlType)
Returns a string representation of a sql type constant. If the passed sql type is not valid, a string representation of its value as an int is returned. This method is most often used in debugging profile entry representations.

See Also:
getSQLType, isValidSQLType
 o getName
 public abstract String getName()
Returns the name of the variable or column producing this type.

If this object is used to describe a parameter to a sql operation (a la EntryInfo.getParamInfo), then getName will return the name of the variable associated with this parameter in the original source file. If the name of the variable cannot be determined or cannot be expressed in terms of a simple name, null is returned. If the parameter is a complex expression, null will be returned.

If this object is used to describe a column of a result set produced by a sql operation (a la EntryInfo.getResultSetInfo), then getName will return the name of the column in the result set to which this type is bound. If the column name could not be determined, null is returned. Note that this name is required to match the name of a column in the result of a sql operation if and only if the entry info indicates that results are bound by name.

Returns:
the name of the variable or column producing this type.
See Also:
getParamInfo, getResultSetInfo, getResultSetType
 o getMode
 public abstract int getMode()
Returns the modality of this parameter. The value returned will be one of the constants IN, OUT, or INOUT.

 o isValidMode
 public static boolean isValidMode(int mode)
Returns true if the passed int parameter represents a valid mode type, false otherwise. Valid sql mode values are those constants which may be returned byt he getMode method.

See Also:
getMode
 o modeToString
 public static String modeToString(int mode)
Returns a string representation of a mode constant. If the value passed does not represent a valid mode, a string representation of the value as an int is returned. This method is most often used in debugging profile entry representations.

See Also:
getMode, isValidMode
 o getMarkerIndex
 public abstract int getMarkerIndex()
Returns the 0-based index of the '?' marker for this parameter in the sql string. Returns -1 if this object does not represent a parameter.

See Also:
getSQLString
 o validateObject
 public void validateObject() throws InvalidObjectException
Performs validation on the internal state of this type info object. In particular, the mode is checked via the isValidMode routine. An exception is thrown if this type contains invalid state.

To allow for compatibility with future versions, this method is not automatically called during object deserialization. Profile runtime library implementors should call this method as needed at runtime to verify the state of the object. For example, this method could be called from a readObject implementation of a TypeInfo subclass.

It is recommended that subclasses use this method during object construction once state is complete to validate the type.

See Also:
isValidMode

All Packages    This Package  Previous  Next