public abstract class AbstractExtentParameter<T extends BaseDataType> extends AbstractParameter
AbstractParameter.Scope, AbstractParameter.WorkArea
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<? extends BaseDataType> |
argType
The class of the elements of the extent argument that was passed to procedure.
|
protected java.lang.reflect.Constructor<?> |
convCtor
The optional conversion constructor that will convert the argument item to local parameter
values back when the calling routine is about to start.
|
private T[] |
parameter
The latest parameter reference.
|
protected java.lang.Class<? extends BaseDataType> |
paramType
The class of the elements of the extent parameter that procedure expects.
|
protected java.lang.reflect.Constructor<?> |
retConvCtor
The optional conversion constructor that will convert the local parameter values back to
argument item when the calling routine ends.
|
private T[] |
variable
The original variable set to the parameter.
|
context, LOG
Modifier | Constructor and Description |
---|---|
protected |
AbstractExtentParameter(T[] variable)
The constructor responsible for instance initialization.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assign(java.lang.String endingRoutine,
boolean function)
Assign the current value of the parameter variable back to the caller's variable
reference.
|
T[] |
getParameter()
Returns the current reference for the parameter.
|
abstract T[] |
getVariable()
Get the variable reference, passed to the function/procedure's parameter.
|
abstract T[] |
initParameter()
Initializes the parameter value reference which is used in the function/procedure
scope.
|
abstract T[] |
initParameter(int extent)
Initializes the parameter value reference which is used in the function/procedure
scope.
|
protected void |
performAssignment()
An extension point to allow the descendants to provide custom logic for parameter reference
to variable assignment on exit from the function or procedure with which this object is
associated to.
|
void |
setParameter(T[] parameter)
Set the current reference for the parameter.
|
void |
setReturnConversion(java.lang.Class<? extends BaseDataType> argType,
java.lang.Class<? extends BaseDataType> paramType,
java.lang.reflect.Constructor<?> convCtor,
java.lang.reflect.Constructor<?> retConvCtor)
Prepare the input and (backward) output (implicit) conversion constructors for the base type
of this extent argument.
|
abstract void |
setVariable(T[] reference)
Change the caller's reference to the new reference.
|
protected boolean |
validateAssignment(java.lang.String endingRoutine,
boolean function)
An extension point to allow the descendants to provide validation logic
for parameter reference to variable assignment on exit from the function
or procedure with which this object is associated to.
|
getCurrentScope, getLocalParam, getScopeable, isParameter
private T extends BaseDataType[] variable
private T extends BaseDataType[] parameter
protected java.lang.Class<? extends BaseDataType> argType
protected java.lang.Class<? extends BaseDataType> paramType
protected java.lang.reflect.Constructor<?> retConvCtor
protected java.lang.reflect.Constructor<?> convCtor
protected AbstractExtentParameter(T[] variable)
The c'tor caches the variable reference in this instance. If null
is
passed to variable
, the value reference is retrieved by calling
getVariable()
, otherwise the passed-in value is used.
variable
- The value reference passed to the function/procedure's parameter or null
.public abstract T[] getVariable()
public abstract void setVariable(T[] reference)
reference
- The new reference.public abstract T[] initParameter()
Use this method to initialize parameter values representing unfixed indeterminate extents.
public abstract T[] initParameter(int extent)
Use this method to initialize parameter values representing determinate extents.
extent
- The extent size declared by the function/procedure parameter.public T[] getParameter()
public void setParameter(T[] parameter)
protected void assign(java.lang.String endingRoutine, boolean function)
endingRoutine
- The legacy name of the routine that is ending when these back assignments are
performed.function
- true
if the called routine is a function.protected boolean validateAssignment(java.lang.String endingRoutine, boolean function)
To indicate a failed validation, indicate an error with help of ErrorManager
.
endingRoutine
- The legacy name of the routine that is ending when these back assignments are
performed.function
- true
is the called routine is a function.true
which means that the parameters are safe
to be assigned back to original data holders. Subclasses may return false (and
use ErrorManager
to indicate an error) if the held vaues are invalid.protected void performAssignment()
The default implementation creates an array copy of the current parameter reference,
implements decimal precision management and stores the copy to the target variable by
calling setVariable(BaseDataType[])
.
The method is called only when there is no pending error being indicated by
ErrorManager
.
public void setReturnConversion(java.lang.Class<? extends BaseDataType> argType, java.lang.Class<? extends BaseDataType> paramType, java.lang.reflect.Constructor<?> convCtor, java.lang.reflect.Constructor<?> retConvCtor)
retConvCtor
will be used to convert the
resulted values to caller datatype.
argType
- The element argument type that was used in procedure call.paramType
- The element type of expected parameter.convCtor
- The conversion constructor. Only for INPUT-OUTPUT parameters. In the case of
OUTPUT parameters, this is ignored and should be null
.retConvCtor
- The return conversion constructor.