Progress
Open Client
Developer’s Guide


INPUT-OUTPUT and OUTPUT Parameters

Java supports no direct mechanism to return a value from a method using parameters. However, any Java application can provide object parameters (holder objects) to contain the value that you want to return.

Holder Classes

For each of the Java data types that map to a Progress data type, there is a Holder class. These Holder classes belong to the com.progress.open4gl package and extend the com.progress.open4gl.Holder class shown in Example 5–1.

// Holder Definition
Public class Holder
{
  public Holder();
  public void setValue(Object value);
  public Object getValue();
  public boolean isNull();
} 

Example 5–1: Output Holder Class

For an INPUT-OUTPUT parameter, you can set an input value to the 4GL unknown value (?) by calling setValue(null) on the holder object. For OUTPUT parameters, the application can find out whether an unknown output value is returned by calling the isNull() method or by testing for a null return value from the getValue() method on the holder object.

Table 5–2 shows the 4GL-to-Java mapping of input-output and output parameters to specific Holder classes.

Table 5–2: Progress/Java Data Type Map For Output Parameters  
Progress Data Type
Java Proxy Data Type
CHARACTER
com.progress.open4gl.StringHolder
COM-HANDLE
com.progress.open4gl.COMHandleHolder
DATE
com.progress.open4gl.DateHolder
DECIMAL
com.progress.open4gl.BigDecimalHolder
INTEGER
com.progress.open4gl.IntHolder
LOGICAL
com.progress.open4gl.BooleanHolder
MEMPTR
com.progress.open4gl.MemptrHolder
RAW
com.progress.open4gl.ByteArrayHolder
RECID
com.progress.open4gl.LongHolder
ROWID
com.progress.open4gl.RowidHolder
TABLE-HANDLE
com.progress.open4gl.ResultSetHolder
TEMP-TABLE
com.progress.open4gl.ResultSetHolder
WIDGET-HANDLE
com.progress.open4gl.HandleHolder

Holder Class Definitions

The Holder class definitions for each data type follow the form shown in Example 5–2.

public class IntHolder extends Holder
{
  public IntHolder();
  public IntHolder(int value);
  public void setIntValue(int value);
  public int getIntValue();
}

// Note the extra constructor on this one.
public class BigDecimalHolder extends Holder
{
  public BigDecimalHolder();
  public BigDecimalHolder(java.math.BigDecimal value);
  public BigDecimalHolder(double);
  public void setBigDecimalValue(BigDecimal value)
  public java.math.BigDecimal getBigDecimalValue();
}

public class StringHolder extends Holder
{
  public StringHolder();
  public StringHolder(java.lang.String value);
  public void setStringValue(java.lang.String value);
  public java.lang.String getStringValue();
}

public class BooleanHolder extends Holder
{
  public BooleanHolder();
  public BooleanHolder (boolean value);
  public void setBooleanValue(boolean value).
  Public boolean getBooleanValue();
}

public class LongHolder extends Holder
{
  public LongHolder();
  public LongHolder(long value);
  public void setLongValue(long value);
  public long getLongValue();
}

/* Holder extensions for other data types follow similar forms */ 

Example 5–2: Holder Class Definitions

Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095