SilverStream
Application Server 3.5

com.sssw.rt.com
Class Variant

java.lang.Object
 |
 +--com.sssw.rt.com.Variant

public class Variant
extends Object

Provides access to the native COM Variant datatype on Windows.


Field Summary
static int VariantArray
          Equivalent to VT_ARRAY modifier.
static int VariantBoolean
          Equivalent to VT_BOOL variant type.
static int VariantByref
          Equivalent to VT_BYREF modifier.
static int VariantByte
          Equivalent to VT_UI1 variant type.
static int VariantCurrency
          Equivalent to VT_CY variant type.
static int VariantDate
          Equivalent to VT_DATE variant type.
static int VariantDispatch
          Equivalent to VT_DISPATCH variant type.
static int VariantDouble
          Equivalent to VT_R8 variant type.
static int VariantEmpty
          Equivalent to VT_EMPTY variant type.
static int VariantError
          Equivalent to VT_ERROR variant type.
static int VariantFloat
          Equivalent to VT_R4 variant type.
static int VariantInt
          Equivalent to VT_I4 variant type.
static int VariantNull
          Equivalent to VT_NULL variant type.
static int VariantObject
          Equivalent to VT_UNKNOWN variant type.
static int VariantShort
          Equivalent to VT_I2 variant type.
static int VariantString
          Equivalent to VT_BSTR variant type.
static int VariantTypeMask
          Equivalent to masking off variant type modifiers.
static int VariantVariant
          Equivalent to VT_VARIANT variant type.
 
Constructor Summary
Variant()
          Create an empty Varant.
Variant(boolean val)
          Create a Variant of type VT_BOOL.
Variant(double val)
          Create a Variant of type VT_R8.
Variant(int val)
          Create a Variant of type VT_I4.
Variant(String val)
          Create a Variant of type VT_BSTR.
 
Method Summary
 void changeType(int vartype)
          Invoke native VariantChangeType function.
 boolean getBoolean()
          Get a boolean value from a VT_BOOL Variant
 byte getByte()
          Get a byte value from a VT_UI1 Variant.
 long getCurrency()
          Get a long value from a VT_CY Variant.
 double getDate()
          Get a long value from a VT_DATE Variant.
 com.sssw.rt.com.IUnknown getDispatch()
          Get a value contained in a VT_DISPATCH Variant.
 double getDouble()
          Get a double value from a VT_R8 Variant.
 void getEmpty()
          Verify that the Variant in question is indeed of type VT_EMPTY.
 int getError()
          Get a value contained a VT_ERROR Variant.
 float getFloat()
          Get a float value from a VT_R4 Variant.
 int getInt()
          Get an int value from a VT_I4 Variant.
 void getNull()
          Verify that the Variant in question is indeed of type VT_NULL.
 com.sssw.rt.com.IUnknown getObject()
          Get a value contained in a VT_UNKNOWN Variant.
 short getShort()
          Get a short value from a VT_I2 Variant.
 String getString()
          Get a String value from a VT_BSTR Variant.
 int getvt()
          Get the type of the Variant.
 void noParam()
          Set the Variant to represent a missing optional parameter.
 void putBoolean(boolean val)
          Clear the old value contained in the Variant.
 void putBooleanRef(boolean val)
          Set the value pointed to by an existing VT_BYREF|VT_BOOL Variant object to the new boolean value.
 void putByte(byte val)
          Clear the old value contained in the Variant.
 void putByteRef(byte val)
          Set the value pointed to by an existing VT_BYREF|VT_UI1 Variant object to the new byte value.
 void putCurrency(long val)
          Clear the old value contained in the Variant.
 void putCurrencyRef(long val)
          Set the value pointed to by an existing VT_BYREF|VT_CY Variant object to the new long currency value.
 void putDate(double val)
          Clear the old value contained in the Variant.
 void putDateRef(double val)
          Set the value pointed to by an existing VT_BYREF|VT_DATE Variant object to the new long date value.
 void putDispatch(Object val)
          Clear the old value contained in the Variant.
 void putDispatchRef(Object val)
          Set the value pointed to by an existing VT_BYREF|VT_DISPATCH Variant object to the new IUnknown value.
 void putDouble(double val)
          Clear the old value contained in the Variant.
 void putDoubleRef(double val)
          Set the value pointed to by an existing VT_BYREF|VT_R8 Variant object to the new double value.
 void putEmpty()
          Clear the old value contained in the Variant.
 void putError(int val)
          Clear the old value contained in the Variant.
 void putErrorRef(int val)
          Set the value pointed to by an existing VT_BYREF|VT_ERROR Variant object to the new int value.
 void putFloat(float val)
          Clear the old value contained in the Variant.
 void putFloatRef(float val)
          Set the value pointed to by an existing VT_BYREF|VT_R4 Variant object to the new float value.
 void putInt(int val)
          Clear the old value contained in the Variant.
 void putIntRef(int val)
          Set the value pointed to by an existing VT_BYREF|VT_I4 Variant object to the new int value.
 void putNull()
          Clear the old value contained in the Variant.
 void putObject(Object val)
          Clear the old value contained in the Variant.
 void putObjectRef(Object val)
          Set the value pointed to by an existing VT_BYREF|VT_UNKNOWN Variant object to the new IUnknown value.
 void putShort(short val)
          Clear the old value contained in the Variant.
 void putShortRef(short val)
          Set the value pointed to by an existing VT_BYREF|VT_I2 Variant object to the new short value.
 void putString(String val)
          Clear the old value contained in the Variant.
 void putStringRef(String val)
          Set the value pointed to by an existing VT_BYREF|VT_BSTR Variant object to the new String value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VariantArray

public static final int VariantArray
Equivalent to VT_ARRAY modifier.

VariantBoolean

public static final int VariantBoolean
Equivalent to VT_BOOL variant type.

VariantByref

public static final int VariantByref
Equivalent to VT_BYREF modifier.

VariantByte

public static final int VariantByte
Equivalent to VT_UI1 variant type.

VariantCurrency

public static final int VariantCurrency
Equivalent to VT_CY variant type.

VariantDate

public static final int VariantDate
Equivalent to VT_DATE variant type.

VariantDispatch

public static final int VariantDispatch
Equivalent to VT_DISPATCH variant type.

VariantDouble

public static final int VariantDouble
Equivalent to VT_R8 variant type.

VariantEmpty

public static final int VariantEmpty
Equivalent to VT_EMPTY variant type.

VariantError

public static final int VariantError
Equivalent to VT_ERROR variant type.

VariantFloat

public static final int VariantFloat
Equivalent to VT_R4 variant type.

VariantInt

public static final int VariantInt
Equivalent to VT_I4 variant type.

VariantNull

public static final int VariantNull
Equivalent to VT_NULL variant type.

VariantObject

public static final int VariantObject
Equivalent to VT_UNKNOWN variant type.

VariantShort

public static final int VariantShort
Equivalent to VT_I2 variant type.

VariantString

public static final int VariantString
Equivalent to VT_BSTR variant type.

VariantTypeMask

public static final int VariantTypeMask
Equivalent to masking off variant type modifiers.

VariantVariant

public static final int VariantVariant
Equivalent to VT_VARIANT variant type.
Constructor Detail

Variant

public Variant()
Create an empty Varant.

Variant

public Variant(int val)
Create a Variant of type VT_I4.
Parameters:
val - inital int value

Variant

public Variant(double val)
Create a Variant of type VT_R8.
Parameters:
val - inital double value

Variant

public Variant(boolean val)
Create a Variant of type VT_BOOL.
Parameters:
val - inital boolean value

Variant

public Variant(String val)
Create a Variant of type VT_BSTR.
Parameters:
val - inital String value
Method Detail

changeType

public void changeType(int vartype)
Invoke native VariantChangeType function.
Parameters:
vartype - constant indicating the traget type (defined in this class)

getBoolean

public boolean getBoolean()
Get a boolean value from a VT_BOOL Variant
Returns:
boolean value contained in the Variant

putBoolean

public void putBoolean(boolean val)
Clear the old value contained in the Variant. Set the new value to the boolean value provided and type to VT_BOOL.
Parameters:
val - new boolean value

putBooleanRef

public void putBooleanRef(boolean val)
Set the value pointed to by an existing VT_BYREF|VT_BOOL Variant object to the new boolean value.
Parameters:
val - new boolean value

getByte

public byte getByte()
Get a byte value from a VT_UI1 Variant.
Returns:
byte value contained in the Variant

putByte

public void putByte(byte val)
Clear the old value contained in the Variant. Set the new value to the byte value provided and type to VT_UI1.
Parameters:
val - new boolean value

putByteRef

public void putByteRef(byte val)
Set the value pointed to by an existing VT_BYREF|VT_UI1 Variant object to the new byte value.
Parameters:
val - new byte value

getCurrency

public long getCurrency()
Get a long value from a VT_CY Variant.
Returns:
long currency value contained in the Variant

putCurrency

public void putCurrency(long val)
Clear the old value contained in the Variant. Set the new value to the boolean value provided and type to VT_CY.
Parameters:
val - new long currency value

putCurrencyRef

public void putCurrencyRef(long val)
Set the value pointed to by an existing VT_BYREF|VT_CY Variant object to the new long currency value.
Parameters:
val - new long currency value

getDate

public double getDate()
Get a long value from a VT_DATE Variant.
Returns:
date value contained in the Variant converted to Java long

putDate

public void putDate(double val)
Clear the old value contained in the Variant. Set the new value to the date value provided and type to VT_CY.
Parameters:
val - new long date value

putDateRef

public void putDateRef(double val)
Set the value pointed to by an existing VT_BYREF|VT_DATE Variant object to the new long date value.
Parameters:
val - new long date value

getFloat

public float getFloat()
Get a float value from a VT_R4 Variant.
Returns:
float value contained in the Variant

putFloat

public void putFloat(float val)
Clear the old value contained in the Variant. Set the new value to the float value provided and type to VT_R4.
Parameters:
val - new float value

putFloatRef

public void putFloatRef(float val)
Set the value pointed to by an existing VT_BYREF|VT_R4 Variant object to the new float value.
Parameters:
val - new float value

getDouble

public double getDouble()
Get a double value from a VT_R8 Variant.
Returns:
double value contained in the Variant

putDouble

public void putDouble(double val)
Clear the old value contained in the Variant. Set the new value to the double value provided and type to VT_R8.
Parameters:
val - new double value

putDoubleRef

public void putDoubleRef(double val)
Set the value pointed to by an existing VT_BYREF|VT_R8 Variant object to the new double value.
Parameters:
val - new float value

getDispatch

public com.sssw.rt.com.IUnknown getDispatch()
Get a value contained in a VT_DISPATCH Variant.
Returns:
value contained in the Variant converted to IUnknown object
See Also:
IUnknown

putDispatch

public void putDispatch(Object val)
Clear the old value contained in the Variant. Set the new value to the IUnknown of the object provided and type to VT_DISPATCH.
Parameters:
val - new object whose IUnknown is stored in the Variant
See Also:
IUnknown

putDispatchRef

public void putDispatchRef(Object val)
Set the value pointed to by an existing VT_BYREF|VT_DISPATCH Variant object to the new IUnknown value.
Parameters:
val - new object whose IUnknown is stored in the Variant
See Also:
IUnknown

getError

public int getError()
Get a value contained a VT_ERROR Variant.
Returns:
a value contained in the Variant converted to a Java int

putError

public void putError(int val)
Clear the old value contained in the Variant. Set the new value to the int value provided and type to VT_ERROR.
Parameters:
val - new int value

putErrorRef

public void putErrorRef(int val)
Set the value pointed to by an existing VT_BYREF|VT_ERROR Variant object to the new int value.
Parameters:
val - new int value

getObject

public com.sssw.rt.com.IUnknown getObject()
Get a value contained in a VT_UNKNOWN Variant.
Returns:
value contained in the Variant converted to IUnknown object
See Also:
IUnknown

putObject

public void putObject(Object val)
Clear the old value contained in the Variant. Set the new value to the IUnknown of the object provided and type to VT_UNKNOWN.
Parameters:
val - new object whose IUnknown is stored in the Variant
See Also:
IUnknown

putObjectRef

public void putObjectRef(Object val)
Set the value pointed to by an existing VT_BYREF|VT_UNKNOWN Variant object to the new IUnknown value.
Parameters:
val - new object whose IUnknown is stored in the Variant
See Also:
IUnknown

getShort

public short getShort()
Get a short value from a VT_I2 Variant.
Returns:
short value contained in the Variant

putShort

public void putShort(short val)
Clear the old value contained in the Variant. Set the new value to the short value provided and type to VT_I2.
Parameters:
val - new short value

putShortRef

public void putShortRef(short val)
Set the value pointed to by an existing VT_BYREF|VT_I2 Variant object to the new short value.
Parameters:
val - new short value

getInt

public int getInt()
Get an int value from a VT_I4 Variant.
Returns:
short value contained in the Variant

putInt

public void putInt(int val)
Clear the old value contained in the Variant. Set the new value to the int value provided and type to VT_I4.
Parameters:
val - new int value

putIntRef

public void putIntRef(int val)
Set the value pointed to by an existing VT_BYREF|VT_I4 Variant object to the new int value.
Parameters:
val - new int value

getString

public String getString()
Get a String value from a VT_BSTR Variant.
Returns:
a value contained in the Variant converted to Java String

putString

public void putString(String val)
Clear the old value contained in the Variant. Set the new value to the String value provided and type to VT_BSTR.
Parameters:
val - new String value

putStringRef

public void putStringRef(String val)
Set the value pointed to by an existing VT_BYREF|VT_BSTR Variant object to the new String value.
Parameters:
val - new String value

putNull

public void putNull()
Clear the old value contained in the Variant. Set the new type to VT_NULL.

getNull

public void getNull()
Verify that the Variant in question is indeed of type VT_NULL. Return quetly if it is.

getEmpty

public void getEmpty()
Verify that the Variant in question is indeed of type VT_EMPTY. Return quetly if it is.

putEmpty

public void putEmpty()
Clear the old value contained in the Variant. Set the new type to VT_EMPTY.

getvt

public int getvt()
Get the type of the Variant.
Returns:
int code (one of the constants defined in this class) for the type of the Variant.

noParam

public void noParam()
Set the Variant to represent a missing optional parameter. It is equivalent to calling putError(0x80020004) on the Variant.

SilverStream
Application Server 3.5