Chapter 1 Java Classes and Interfaces
package com.sybase.jaguar.util; public class <object>Holder extends Object
For components that use the Jaguar-JDBC type mappings, holder classes are used to pass INOUT parameters to component method calls. Each holder class has a value field that contains instances of a specific object or base Java type.
Additional holder classes are defined in packages com.sybase.jaguar.util.jdbc102 and com.sybase.jaguar.util.jdbc11.
com.sybase.jaguar.util holder classes are summarized in the Table 1-2.
| Holder class | Datatype for value field | Default for value |
|---|---|---|
BooleanHolder
|
boolean
|
false |
ByteHolder
|
byte
|
0 |
BytesHolder
|
byte[]
|
null |
CharHolder
|
char
|
\u0000 (null character) |
FloatHolder
|
float
|
0.0 |
DoubleHolder
|
double
|
0.0 |
IntegerHolder
|
int
|
0 |
LongHolder
|
long
|
0 |
ShortHolder
|
short
|
0 |
StringHolder
|
java.lang.String
|
null |
| WARNING! | Null parameter values are not supported. For StringHolder or BytesHolder parameters, use the constructor that takes an initial value, or set the value field explicitly. | ||
<object>Holder()
Default constructor that assigns the default value specified in Table 1-2.
<object>Holder(<object> initialValue)
Constructor that takes an initial value specified as initialValue. initialValue is an instance of the appropriate datatype as specified in Table 1-2.
The current value contained by the holder object. Table 1-2 lists the datatypes and default values for the value field.
Java component methods on the server receive INOUT parameters as a holder object. The method should set the value field of each holder object before returning.
The examples below illustrate how to construct and use holder objects:
StringHolder str_holder = new StringHolder(); IntegerHolder int_holder = new IntegerHolder();
StringHolder str_holder =
new StringHolder("hello");
IntegerHolder int_holder = new IntegerHolder(43);
float f = 3.141;
FloatHolder float_holder = new FloatHolder(f);
IntegerHolder i_hold = new IntegerHolder(); System.out.println( "IntegerHolder default value is:" + i_hold.value);
jaguar.util.jdbc102.<object>Holder class, jaguar.util.jdbc11.<object>Holder class
| Copyright (C) 2004. Sybase Inc. All rights reserved. |
| |