public static class AbstractParameter.Scope extends java.lang.Object implements OutputParameterAssigner
After exiting a function or procedure, the
OutputParameterAssigner.processAssignments(String, boolean)
method is invoked, which
causes each field assigner to assign the current value of its parameter value back to the
associated DMO property.
Modifier and Type | Field and Description |
---|---|
private java.util.List<AbstractParameter> |
allParameters
All parameter references, in their defining order.
|
private java.util.List<AbstractExtentParameter> |
extentParameters
The list with the wrapped extent parameters, created lazily.
|
private java.util.Map<BaseDataType,AbstractSimpleParameter> |
simpleParameters
Map of output simple parameter assigners for this scope, created lazily.
|
private java.util.Map<BaseDataType,java.lang.Object[]> |
withConversionCtor
Additional state computed by
ControlFlowOps parameter validation, when the argument and
parameter type does not match. |
Constructor and Description |
---|
Scope() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Some error occurred.
|
void |
addExtentParameter(AbstractExtentParameter<?> param)
Registers an extent parameter wrapper class to be included in the scope processing.
|
void |
addSimpleParameter(AbstractSimpleParameter assigner)
Add a parameter assigner to this scope.
|
protected void |
clear()
Clears internal data.
|
protected boolean |
isExtentParameter(BaseDataType[] key)
Check if the given array reference was passed as a parameter, by looking into all scopes.
|
protected boolean |
isParameter(BaseDataType key)
Check if the
BaseDataType passed as parameter is used for lookup of an
OUTPUT parameter. |
void |
processAssignments(java.lang.String endingRoutine,
boolean function)
Cause each (if any) field assigner in the current scope to assign the current value of
its parameter value back to the DMO property with which it is associated.
|
protected void |
replaceParameter(BaseDataType[] old,
BaseDataType[] other)
Replace the extent array parameter reference (not the original argument) with the new one.
|
protected void |
updateSimpleParameter(BaseDataType key,
BaseDataType newVar,
java.lang.reflect.Constructor<?> convCtor)
Update the wrapper variable for a
AbstractOutputParameterAssigner . |
private java.util.Map<BaseDataType,AbstractSimpleParameter> simpleParameters
private java.util.List<AbstractExtentParameter> extentParameters
private java.util.List<AbstractParameter> allParameters
private java.util.Map<BaseDataType,java.lang.Object[]> withConversionCtor
ControlFlowOps
parameter validation, when the argument and
parameter type does not match. This will be used when the AbstractParameter.postProcessOutput(com.goldencode.p2j.util.AbstractSimpleParameter, com.goldencode.p2j.util.BaseDataType)
is executed for an OUTPUT parameter.
WARNING: although this will always register via updateSimpleParameter(com.goldencode.p2j.util.BaseDataType, com.goldencode.p2j.util.BaseDataType, java.lang.reflect.Constructor<?>)
in the current scope,
it will be 'consumed' before the callee's scope opens, when the OUTPUT parameter is initialized.
public void abort()
abort
in interface OutputParameterAssigner
public void processAssignments(java.lang.String endingRoutine, boolean function)
processAssignments
in interface OutputParameterAssigner
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.public void addSimpleParameter(AbstractSimpleParameter assigner)
assigner
- Simple field assigner.protected boolean isParameter(BaseDataType key)
BaseDataType
passed as parameter is used for lookup of an
OUTPUT
parameter.key
- The variable for lookup in the current scope.true
if the content of key
will be assigned back on return with
success.protected boolean isExtentParameter(BaseDataType[] key)
key
- The array reference.protected void replaceParameter(BaseDataType[] old, BaseDataType[] other)
old
- The previous array parameter reference.other
- The new reference.protected void updateSimpleParameter(BaseDataType key, BaseDataType newVar, java.lang.reflect.Constructor<?> convCtor)
AbstractOutputParameterAssigner
.key
- The old key variable. May be the intermediary wrapper for a field or the real
variable passed as *OUTPUT parameter.newVar
- The new wrapper variable that will be used inside the calling procedure. At the
end of the call its value will be converted using convCtor
and assigned
to wrapped field or original variable.convCtor
- The conversion constructor that will cast the new variable to old variable type
in order to be assigned to field.public void addExtentParameter(AbstractExtentParameter<?> param)
param
- Extent parameter wrapper class.protected void clear()