com.iplanet.jato.model.sql
Class StoredProcParameterDescriptor

java.lang.Object
  |
  +--com.iplanet.jato.model.sql.StoredProcParameterDescriptor
All Implemented Interfaces:
java.io.Serializable

public class StoredProcParameterDescriptor
extends java.lang.Object
implements java.io.Serializable

Encapsulates the metadata needed to describe a StoredProcModel logical field.

The StoredProcModelBase relies on a collection of StoredProcParameterDescriptors to supply the metadata that is required to dynamically prepare and execute the stored procedure. To this end, the descriptor contains metadata which describes the physical stored procedure parameter, such as the parameter name, whether it is an input/output/in-out or return parameter.

Additionally, StoredProcModelBase relies on the descriptor to provide the logical model field name and type. It is the logical field, not the parameter name, that the model interface exposes via the Model.getValue(String) and setValue(String, Object) operations, amongst others. This allows application developers to access the model's logical fields in an object oriented fashion. Internally, StoredProcModelBase will map the logical field to the physical parameter as needed.

Note, the name of the logical model field need not be identical with the physical stored procedure parameter name.

Version:
JATO/1.2.2 $Id: StoredProcParameterDescriptor.java,v 1.11 2002/03/16 03:26:34 todd Exp $
See Also:
StoredProcSchema, StoredProcModel, StoredProcModelBase, Serialized Form

Field Summary
static int PARAM_IN
          Specifies an input parameter
static int PARAM_INOUT
          Specifies an in-out parameter
static int PARAM_OUT
          Specifies an out parameter
static int PARAM_RESULT
          Specifies a result parameter
 
Constructor Summary
StoredProcParameterDescriptor()
          Default constructor.
StoredProcParameterDescriptor(java.lang.String logicalName, java.lang.String paramName, int paramType, int sqlType, java.lang.Class fieldClass)
           
 
Method Summary
 java.lang.Class getFieldClass()
          Deprecated. Use getParameterClass() instead
 java.lang.String getName()
          Returns the name of the logical model field.
 java.lang.Class getParameterClass()
          Returns the logical field type.
 int getParameterType()
          Returns the parameter type.
 java.lang.String getParamName()
          Returns the physical stored procedure parameter name.
 int getSQLType()
          Return the parameter's SQL type.
 void setFieldClass(java.lang.Class value)
          Deprecated. Use setParameterClass() instead
 void setName(java.lang.String value)
          Sets the name of the logical model field.
 void setParameterClass(java.lang.Class value)
          Specifies the logical field type.
 void setParameterType(int value)
          Sets the parameter type.
 void setParamName(java.lang.String value)
          Specifies the physical stored procedure parameter name.
 void setSQLType(int value)
          Sets the parameter's SQL type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_RESULT

public static final int PARAM_RESULT
Specifies a result parameter

PARAM_IN

public static final int PARAM_IN
Specifies an input parameter

PARAM_OUT

public static final int PARAM_OUT
Specifies an out parameter

PARAM_INOUT

public static final int PARAM_INOUT
Specifies an in-out parameter
Constructor Detail

StoredProcParameterDescriptor

public StoredProcParameterDescriptor()
Default constructor. An object created with this constructor must be customized in order to be valid, therefore we do not generally recommend use of this constructor.

StoredProcParameterDescriptor

public StoredProcParameterDescriptor(java.lang.String logicalName,
                                     java.lang.String paramName,
                                     int paramType,
                                     int sqlType,
                                     java.lang.Class fieldClass)
Parameters:
logicalName - Associates this descriptor with a model field, not to be confused with the actual stored procedure parameter name.
paramName - The physical stored procedure parameter name.
paramType - The parameter type, one of PARAM_IN, PARAM_OUT, PARAM_INOUT, or PARAM_RESULT
sqlType - The actual parameter type as required for proper construction of the CallableStatement. May be any one of the constants specified in java.sql.Types. Such as java.sql.Types.NUMERIC, java.sql.Types.INTEGER, java.sql.Types.VARCHAR, etc.
fieldClass - The logical model field type. Not to be confused with the sqlType. The logical model field type may be, but need not be identical with the sqlType.
Method Detail

getName

public java.lang.String getName()
Returns the name of the logical model field. This is the name of the logical field that the model interface exposes via the Model.getValue(String) and setValue(String, Object) operations, amongst others.

setName

public void setName(java.lang.String value)
Sets the name of the logical model field. This is the name of the logical field that the model interface exposes via the Model.getValue(String) and setValue(String, Object) operations, amongst others.

getParamName

public java.lang.String getParamName()
Returns the physical stored procedure parameter name. This is not to be confused with the logical field name.
		getName()
 

setParamName

public void setParamName(java.lang.String value)
Specifies the physical stored procedure parameter name. This is not to be confused with the logical field name.
		setName(String)
 

getSQLType

public int getSQLType()
Return the parameter's SQL type.
Returns:
The actual parameter type as required for proper construction of the CallableStatement. May be any one of the constants specified in java.sql.Types. Such as java.sql.Types.NUMERIC, java.sql.Types.INTEGER, java.sql.Types.VARCHAR, etc.

setSQLType

public void setSQLType(int value)
Sets the parameter's SQL type.
Parameters:
value - The actual parameter type as required for proper construction of the CallableStatement. May be any one of the constants specified in java.sql.Types. Such as java.sql.Types.NUMERIC, java.sql.Types.INTEGER, java.sql.Types.VARCHAR, etc.

getFieldClass

public java.lang.Class getFieldClass()
Deprecated. Use getParameterClass() instead


setFieldClass

public void setFieldClass(java.lang.Class value)
Deprecated. Use setParameterClass() instead


getParameterClass

public java.lang.Class getParameterClass()
Returns the logical field type.
Returns:
The logical model field type. This may be any Java class. This is not to be confused with the SQL type.
		getSQLType()
 

setParameterClass

public void setParameterClass(java.lang.Class value)
Specifies the logical field type.
Parameters:
value - The logical model field type. This may be any Java class. This is not to be confused with the SQL type but is usually assignable from the SQL type.
		setSQLType(int)
 

getParameterType

public int getParameterType()
Returns the parameter type.
Returns:
The parameter type, one of PARAM_IN, PARAM_OUT, PARAM_INOUT, or PARAM_RESULT

setParameterType

public void setParameterType(int value)
Sets the parameter type.
Parameters:
value - The parameter type, one of PARAM_IN, PARAM_OUT, PARAM_INOUT, or PARAM_RESULT