com.ibm.as400.access
Class ProgramParameter

java.lang.Object
  |
  +--com.ibm.as400.access.ProgramParameter
All Implemented Interfaces:
java.io.Serializable

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

The ProgramParameter class is used with ProgramCall and ServiceProgramCall to pass parameter data to a program, from a program, or both. Input data is passed to a program as a byte array with setInputData. Output data is requested from a program by specifying the amount of data to return with setOutputDataLength. To get the output data once the program has run use getOutputData. These values may also be set on the constructor.

See Also:
Serialized Form

Field Summary
static int PASS_BY_REFERENCE
          Constant indicating parameter data is passed by reference.
static int PASS_BY_VALUE
          Constant indicating parameter data is passed by value.
 
Constructor Summary
ProgramParameter()
          Constructs a ProgramParameter object.
ProgramParameter(byte[] inputData)
          Constructs a ProgramParameter object.
ProgramParameter(byte[] inputData, int outputDataLength)
          Constructs ProgramParameter object.
ProgramParameter(int outputDataLength)
          Constructs a ProgramParameter object.
ProgramParameter(int parameterType, byte[] inputData)
          Constructs a ProgramParameter object.
ProgramParameter(int parameterType, byte[] inputData, int outputDataLength)
          Constructs ProgramParameter object.
ProgramParameter(int parameterType, int outputDataLength)
          Constructs a ProgramParameter object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds a VetoableChangeListener.
 byte[] getInputData()
          Returns the parameter data that will be sent to the program.
 byte[] getOutputData()
          Returns the parameter data that has been received from the program.
 int getOutputDataLength()
          Returns the output parameter data length.
 int getParameterType()
          Returns the program parameter type.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes this PropertyChangeListener.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Removes this VetoableChangeListener.
 void setInputData(byte[] inputData)
          Sets the parameter data that will be sent to the program.
 void setOutputDataLength(int outputDataLength)
          Sets the output parameter data length.
 void setParameterType(int parameterType)
          Sets the type of program parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASS_BY_VALUE

public static final int PASS_BY_VALUE
Constant indicating parameter data is passed by value. (This is the default.)

PASS_BY_REFERENCE

public static final int PASS_BY_REFERENCE
Constant indicating parameter data is passed by reference.
Constructor Detail

ProgramParameter

public ProgramParameter()
Constructs a ProgramParameter object.

ProgramParameter

public ProgramParameter(byte[] inputData)
Constructs a ProgramParameter object. An input parameter is created since a byte array containing parameter data is passed on this constructor.
Parameters:
inputData - The parameter data to be used as input to the program.

ProgramParameter

public ProgramParameter(int outputDataLength)
Constructs a ProgramParameter object. An output parameter is created, since the size of the output data is passed on this constructor.
Parameters:
outputDataLength - The amount of data to be returned from the program.

ProgramParameter

public ProgramParameter(byte[] inputData,
                        int outputDataLength)
Constructs ProgramParameter object. A parameter that is both an input and an output parameter is created, since both data passed to the program and the amount of data returned from the program are passed on this constructor.
Parameters:
inputData - Parameter data passed to the program.
outputDataLength - The amount of data to be returned from the program.

ProgramParameter

public ProgramParameter(int parameterType,
                        byte[] inputData)
Constructs a ProgramParameter object. An input parameter is created, since a byte array containing parameter data is passed on this constructor. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall.
Parameters:
parameterType - The type of parameter.
inputData - The parameter data to be used as input to the program.

ProgramParameter

public ProgramParameter(int parameterType,
                        int outputDataLength)
Constructs a ProgramParameter object. An output parameter is created, since the size of the output data is passed on this constructor. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall.
Parameters:
parameterType - The type of parameter.
outputDataLength - The amount of data to be returned from the program.

ProgramParameter

public ProgramParameter(int parameterType,
                        byte[] inputData,
                        int outputDataLength)
Constructs ProgramParameter object. A parameter that is both an input and an output parameter is created, since both data passed to the program and the amount of data returned from the program are passed on this constructor. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall.
Parameters:
parameterType - The type of parameter.
inputData - The parameter data to be used as input to the program.
outputDataLength - The amount of data to be returned from the program.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyListener object is added to a list of PropertyChangeListeners managed by this ProgramParameter. It can be removed with removePropertyChangeListener.
Parameters:
listener - The PropertyChangeListener.

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a VetoableChangeListener. The specified VetoableChangeListeners vetoableChange method will be called each time the value of any constrained property is changed.
Parameters:
listener - The VetoableChangeListener.

getInputData

public byte[] getInputData()
Returns the parameter data that will be sent to the program. Null is returned if the input data has not been set.
Returns:
The parameter data to be used as input to the program.

getOutputData

public byte[] getOutputData()
Returns the parameter data that has been received from the program. Null is returned if this parameter is an input parameter. Null is also returned before the program is called.
Returns:
The output data returned from the program.

getOutputDataLength

public int getOutputDataLength()
Returns the output parameter data length.
Returns:
The amount of data to be returned from the program (number of bytes).

getParameterType

public int getParameterType()
Returns the program parameter type. The type indicates if data is passed by reference or passed by value. The type attribute is used by ServiceProgramCall.
Returns:
The program parameter type. The type is one of the following:
  • PASS_BY_VALUE The parameter is passed as data.
  • PASS_BY_REFERENCE The parameter is passed as a reference.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes this PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done.
Parameters:
listener - The PropertyChangeListener.

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes this VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done.
Parameters:
listener - The VetoableChangeListener.

setInputData

public void setInputData(byte[] inputData)
                  throws java.beans.PropertyVetoException
Sets the parameter data that will be sent to the program.
Parameters:
inputData - The parameter data to be used as input to the program.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

setOutputDataLength

public void setOutputDataLength(int outputDataLength)
                         throws java.beans.PropertyVetoException
Sets the output parameter data length.
Parameters:
outputDataLength - The amount of data to be returned from the program (number of bytes).
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

setParameterType

public void setParameterType(int parameterType)
                      throws java.beans.PropertyVetoException
Sets the type of program parameter. The type indicates if the data is pass by reference or pass by value. The type attribute is used by ServiceProgramCall.
Parameters:
parameterType - The type of the program parameter. The type must be one of the following:
  • PASS_BY_VALUE The parameter is passed as data.
  • PASS_BY_REFERENCE The parameter is passed as a reference.
The default is PASS_BY_VALUE.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.