BEA Systems, Inc.

weblogic.common
Class ParamValue

java.lang.Object
  extended by weblogic.common.ParamValue
All Implemented Interfaces:
Externalizable, Serializable, Cloneable

public final class ParamValue
extends Object
implements Cloneable, Externalizable

A ParamValue is the value part of a name/value pair used for events and remote procedures.

A ParamSet has keynames, and each keyname has a ParamValue associated with it. A ParamValue may be made up of a vector of ParamValues, in which case the elements in the vector are accessible by index position.

The variables in this class are used for setting attributes for IN, OUT and IN/OUT parameters used for database stored procedures.

Conversions among the various datatypes are handled automatically in a "Java" way, i.e., the conversion can be accomplished either of these ways:

Illegal conversions (for example, int to boolean) throw a ParamSetException.

See Also:
ParamSet, Serialized Form

Field Summary
protected  String paramDesc
          Variable used for IN, OUT, and IN/OUT parameters to set the descriptor of the parameter.
protected  int paramMode
          Variable used for IN, OUT, and IN/OUT parameters to set the mode of the parameter.
protected  String paramName
          Variable used for IN, OUT, and IN/OUT parameters to set the name of the parameter.
protected  int paramType
          Variable used for IN, OUT, and IN/OUT parameters to set the type of the parameter.
 
Constructor Summary
ParamValue()
          Internal use only.
ParamValue(String name, int datatype, int inouttype, String paramDesc)
          Constructs a ParamValue with the specified name, of the specified data type, of the specified parameter type, and of the specified parameter description.
 
Method Summary
 boolean asBoolean()
          Returns a ParamValue as a boolean.
 byte asByte()
          Returns a ParamValue as a byte.
 char asChar()
          Returns a ParamValue as a char.
 Date asDate()
          Returns a ParamValue as a Date.
 double asDouble()
          Returns a ParamValue as a double.
 float asFloat()
          Returns a ParamValue as a float.
 int asInt()
          Returns a ParamValue as a int.
 long asLong()
          Returns a ParamValue as a long.
 Object asObject()
          Returns a ParamValue as an Object.
 short asShort()
          Returns a ParamValue as a short.
 String asString()
          Returns a ParamValue as a String.
 Object clone()
          Clones a ParamValue.
 void destroy()
          Destroys a ParamValue object.
 String dump()
          Returns a formatted string representation of a ParamValue.
 ParamValue elementAt(int index)
          Used for accessing ParamValues in a Vector of ParamValues.
 void initialize()
          Initializes a ParamValue.
 boolean isBoolean()
          Determines whether a ParamValue is of type boolean.
 boolean isByte()
          Determines whether a ParamValue is of type byte.
 boolean isChar()
          Determines whether a ParamValue is of type char.
 boolean isDate()
          Determines whether a ParamValue is of type Date.
 boolean isDouble()
          Determines whether a ParamValue is of type double.
 boolean isFloat()
          Determines whether a ParamValue is of type float.
 boolean isInt()
          Determines whether a ParamValue is of type int.
 boolean isLong()
          Determines whether a ParamValue is of type long.
 boolean isNull()
          Determines whether a ParamValue is null.
 boolean isNull(int index)
          Determines whether a ParamValue that is a vector of ParamValues is null at the specified index position.
 boolean isObject()
          Determines whether a ParamValue is of type Object.
 boolean isScalar()
          Determines whether a ParamValue is scalar.
 boolean isShort()
          Determines whether a ParamValue is of type short.
 boolean isString()
          Determines whether a ParamValue is of type String.
 boolean isVector()
          Determines whether a ParamValue is a Vector.
 String name()
          Returns the paramName of a ParamValue.
 String paramDesc()
          Returns the paramDesc of a ParamValue.
 int paramMode()
          Returns the paramMode of a ParamValue.
 String paramModeString()
          Returns the paramMode of a ParamValue as a String.
 int paramType()
          Returns the paramType of a ParamValue.
 String paramTypeString()
          Returns the paramType of a ParamValue as a String.
 void readExternal(ObjectInput oi)
          Constructs a ParamValue from the specified serialization stream
 ParamValue set(boolean val)
          Sets the value of a ParamValue to a boolean.
 ParamValue set(boolean val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified boolean.
 ParamValue set(byte val)
          Sets the value of a ParamValue to a byte.
 ParamValue set(char val)
          Sets the value of a ParamValue to a char.
 ParamValue set(char val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified char.
 ParamValue set(Date val)
          Sets the value of a ParamValue to a Date.
 ParamValue set(Date val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified date.
 ParamValue set(double val)
          Sets the value of a ParamValue to a double.
 ParamValue set(double val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified double.
 ParamValue set(float val)
          Sets the value of a ParamValue to a float.
 ParamValue set(float val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified float.
 ParamValue set(int val)
          Sets the value of a ParamValue to an int.
 ParamValue set(int val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified int.
 ParamValue set(long val)
          Sets the value of a ParamValue to a long.
 ParamValue set(long val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified long.
 ParamValue set(Object val)
          Sets the value of a ParamValue to an Object.
 ParamValue set(Object val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified Object.
 ParamValue set(ParamValue val)
          Sets the value of a ParamValue to a ParamValue.
 ParamValue set(ParamValue val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified ParamValue.
 ParamValue set(short val)
          Sets the value of a ParamValue to a short.
 ParamValue set(short val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified integer.
 ParamValue set(String val)
          Sets the value of a ParamValue to a String.
 ParamValue set(String val, int index)
          Sets the value at the specified index into a Vector of ParamValues to the specified string.
 void setElementAt(Object value, int index)
          Sets the element at the specified index into Vector of ParamValues to the specified value.
 int size()
          Returns the size of a Vector of ParamValues.
 String toString()
          Returns a string representation of a ParamValue.
 void writeExternal(ObjectOutput oo)
          Writes a ParamValue object to a serialization stream.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

paramName

protected String paramName
Variable used for IN, OUT, and IN/OUT parameters to set the name of the parameter. Default is null.


paramDesc

protected String paramDesc
Variable used for IN, OUT, and IN/OUT parameters to set the descriptor of the parameter. Default is null.


paramType

protected int paramType
Variable used for IN, OUT, and IN/OUT parameters to set the type of the parameter. Default is ParamTypes.NOTYPE.

See Also:
ParamTypes

paramMode

protected int paramMode
Variable used for IN, OUT, and IN/OUT parameters to set the mode of the parameter. Default is ParamTypes.IN.

See Also:
ParamTypes
Constructor Detail

ParamValue

public ParamValue()
Internal use only.


ParamValue

public ParamValue(String name,
                  int datatype,
                  int inouttype,
                  String paramDesc)
Constructs a ParamValue with the specified name, of the specified data type, of the specified parameter type, and of the specified parameter description.

Parameters:
name - Name
datatype - Data type from weblogic.common.ParamTypes
inouttype - Mode from weblogic.common.ParamTypes (IN, IN/OUT, OUT)
paramDesc - Description
See Also:
ParamTypes
Method Detail

initialize

public void initialize()
Initializes a ParamValue. Sets the variables paramName and paramDesc to null; sets the variable paramType to ParamTypes.NOTYPE; and sets the variable paramMode to ParamTypes.IN.


destroy

public void destroy()
Destroys a ParamValue object.


clone

public Object clone()
Clones a ParamValue. The clone is shallow, that is the "value" contained in the ParamValue is not cloned unless it is a Vector.

Overrides:
clone in class Object

readExternal

public void readExternal(ObjectInput oi)
                  throws IOException
Constructs a ParamValue from the specified serialization stream

Specified by:
readExternal in interface Externalizable
Parameters:
in - WLObjectInput
Throws:
IOException - if there is an IO error

writeExternal

public void writeExternal(ObjectOutput oo)
                   throws IOException
Writes a ParamValue object to a serialization stream.

Specified by:
writeExternal in interface Externalizable
Throws:
IOException

name

public String name()
Returns the paramName of a ParamValue.

Returns:
String

paramDesc

public String paramDesc()
Returns the paramDesc of a ParamValue.

Returns:
Parameter description

paramType

public int paramType()
Returns the paramType of a ParamValue.

Returns:
int
See Also:
ParamTypes

paramTypeString

public String paramTypeString()
Returns the paramType of a ParamValue as a String.

Returns:
Data type as a String

paramModeString

public String paramModeString()
Returns the paramMode of a ParamValue as a String.

Returns:
Mode as a String

isNull

public boolean isNull(int index)
Determines whether a ParamValue that is a vector of ParamValues is null at the specified index position.

Parameters:
index - Index into the vector of a ParamValue
Returns:
true if null
Throws:
ParamSetException - if there is an error with the ParamSet

isNull

public boolean isNull()
Determines whether a ParamValue is null.

Returns:
true if null

paramMode

public int paramMode()
Returns the paramMode of a ParamValue.

Returns:
int value of paramMode
See Also:
ParamTypes

isScalar

public boolean isScalar()
Determines whether a ParamValue is scalar. A ParamValue is a scalar or a Vector. A ParamValue may be made up of a Vector of other ParamValues.

Returns:
false if Vector

isVector

public boolean isVector()
Determines whether a ParamValue is a Vector. A ParamValue is a scalar or a Vector. A ParamValue may be made up of a Vector of other ParamValues.

Returns:
true if Vector

isInt

public boolean isInt()
Determines whether a ParamValue is of type int.

Returns:
true if int

isShort

public boolean isShort()
Determines whether a ParamValue is of type short.

Returns:
true if short

isFloat

public boolean isFloat()
Determines whether a ParamValue is of type float.

Returns:
true if float

isDouble

public boolean isDouble()
Determines whether a ParamValue is of type double.

Returns:
true if double

isDate

public boolean isDate()
Determines whether a ParamValue is of type Date.

Returns:
true if Date

isString

public boolean isString()
Determines whether a ParamValue is of type String.

Returns:
true if String

isChar

public boolean isChar()
Determines whether a ParamValue is of type char.

Returns:
true if char

isBoolean

public boolean isBoolean()
Determines whether a ParamValue is of type boolean.

Returns:
true if boolean

isByte

public boolean isByte()
Determines whether a ParamValue is of type byte.

Returns:
true if byte

isLong

public boolean isLong()
Determines whether a ParamValue is of type long.

Returns:
true if long

isObject

public boolean isObject()
Determines whether a ParamValue is of type Object.

Returns:
true if Object

elementAt

public ParamValue elementAt(int index)
Used for accessing ParamValues in a Vector of ParamValues. Returns the nth ParamValue. If the nth ParamValue did not previously exist, then creates a ParamValue at the specified index of type UNKNOWN.

Parameters:
index - Index position
Throws:
ParamSetException - if there is an error with the ParamSet
See Also:
ParamTypes

setElementAt

public void setElementAt(Object value,
                         int index)
Sets the element at the specified index into Vector of ParamValues to the specified value.

Parameters:
value - Value
index - Index position
Throws:
ParamSetException - if the value cannot be set

size

public int size()
Returns the size of a Vector of ParamValues.

Returns:
Size of Vector
Throws:
ParamSetException - if there is an error with the ParamSet

set

public ParamValue set(ParamValue val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified ParamValue. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - Value of type ParamValue
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(boolean val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified boolean. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - boolean value
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(short val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified integer. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - short
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(int val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified int. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - int
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(long val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified long. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - long
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(double val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified double. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - double
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(float val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified float. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - float
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(char val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified char. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - char
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(String val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified string. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - String
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(Date val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified date. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - Date
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(Object val,
                      int index)
Sets the value at the specified index into a Vector of ParamValues to the specified Object. If the ParamValue type is UNKNOWN, first sets the type to VECTOR.

Parameters:
val - Object
index - Index into a Vector of ParamValues
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set
See Also:
ParamTypes

set

public ParamValue set(ParamValue val)
Sets the value of a ParamValue to a ParamValue. If the type is unknown, sets it to the type of the specified ParamValue. If the specified ParamValue is a Vector of other ParamValues, copies the vector to the ParamValue that is returned.

Parameters:
val - ParamValue
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(boolean val)
Sets the value of a ParamValue to a boolean.

Parameters:
val - boolean
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(int val)
Sets the value of a ParamValue to an int.

Parameters:
val - int
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(short val)
Sets the value of a ParamValue to a short.

Parameters:
val - short
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(byte val)
Sets the value of a ParamValue to a byte.

Parameters:
val - byte
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(long val)
Sets the value of a ParamValue to a long.

Parameters:
val - long
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(double val)
Sets the value of a ParamValue to a double.

Parameters:
val - double
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(float val)
Sets the value of a ParamValue to a float.

Parameters:
val - float
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(char val)
Sets the value of a ParamValue to a char.

Parameters:
val - char
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(String val)
Sets the value of a ParamValue to a String.

Parameters:
val - String
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(Date val)
Sets the value of a ParamValue to a Date.

Parameters:
val - Date
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

set

public ParamValue set(Object val)
Sets the value of a ParamValue to an Object.

Parameters:
val - Object
Returns:
ParamValue object
Throws:
ParamSetException - if the value cannot be set

asBoolean

public boolean asBoolean()
Returns a ParamValue as a boolean. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a boolean.

Returns:
boolean
Throws:
ParamSetException - if there is a conversion error

asByte

public byte asByte()
Returns a ParamValue as a byte. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a byte.

Returns:
byte
Throws:
ParamSetException - if there is a conversion error

asInt

public int asInt()
Returns a ParamValue as a int. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a int.

Returns:
int
Throws:
ParamSetException - if there is a conversion error

asShort

public short asShort()
Returns a ParamValue as a short. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a short.

Returns:
short
Throws:
ParamSetException - if there is a conversion error

asLong

public long asLong()
Returns a ParamValue as a long. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a long.

Returns:
long
Throws:
ParamSetException - if there is a conversion error

asDouble

public double asDouble()
Returns a ParamValue as a double. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a double.

Returns:
double
Throws:
ParamSetException - if there is a conversion error

asFloat

public float asFloat()
Returns a ParamValue as a float. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a float.

Returns:
float
Throws:
ParamSetException - if there is a conversion error

asChar

public char asChar()
Returns a ParamValue as a char. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a char.

Returns:
char
Throws:
ParamSetException - if there is a conversion error

asString

public String asString()
Returns a ParamValue as a String. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a String.

Returns:
String
Throws:
ParamSetException - if there is a conversion error

toString

public String toString()
Returns a string representation of a ParamValue.

Overrides:
toString in class Object
Returns:
String

dump

public String dump()
Returns a formatted string representation of a ParamValue.

Returns:
String

asDate

public Date asDate()
Returns a ParamValue as a Date. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a Date.

Returns:
Date
Throws:
ParamSetException - if there is a conversion error

asObject

public Object asObject()
Returns a ParamValue as an Object. If the ParamValue is a Vector of ParamValues, returns the ParamValue at the zeroeth position as a Object.

Returns:
Object
Throws:
ParamSetException - if there is a conversion error

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs100
Copyright 2006 BEA Systems Inc.