com.jniwrapper.win32.automation.types
Class Variant

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.win32.automation.types.Variant
All Implemented Interfaces:
AlignmentAwareParameter, AutoDeleteParameter, CompositeParameter
Direct Known Subclasses:
VariantArg

public class Variant
extends Parameter
implements AutoDeleteParameter, CompositeParameter, AlignmentAwareParameter

The Variant class corresponds to VARIANT native structure.

To simplify the usage, it can be constructed with standard Java and JNIWrapper types.

See Also:
Microsoft Automation SDK documentation

Field Summary
static int LENGTH
           
static int UNSUPPORTED_TYPE
           
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
Variant()
          Creates the new empty instance with VarType.VT_EMPTY type by default.
Variant(boolean value)
           
Variant(double value)
           
Variant(float value)
           
Variant(int value)
           
Variant(long value)
           
Variant(java.lang.Object value)
           
Variant(SafeArray array)
           
Variant(Variant that)
           
Variant(VarType type)
           
 
Method Summary
 void acceptIOPerformer(IOPerformer performer, DataBuffer buffer, int initialOffset, boolean isReadOperation, boolean invokedByCallback)
           
 java.lang.Object clone()
           
static Variant createUnspecifiedParameter()
          Creates value for unspecified parameter in dispinterface interface method call.
 Parameter getActiveMember()
           
 int getAlignmentRequirement()
           
 VariantBool getBoolVal()
           
 BStr getBstrVal()
           
 UInt8 getBVal()
           
 Pointer.Void getByref()
           
 CY getCiVal()
           
 Int8 getCVal()
           
 Date getDate()
           
 DoubleFloat getDblVal()
           
 java.lang.String getDebugInfo()
           
 Decimal getDecVal()
           
static java.lang.Class getElementType(VarType varType)
          Returns one of JNIWrapper types (classes) that corresponds to the specified VarType.
 int getFirstMemberSize()
           
 SingleFloat getFltVal()
           
 HResult getHResultVal()
           
 Int getIntVal()
           
 Int16 getIVal()
           
 int getLength()
           
 Int64 getLlVal()
           
 Int32 getLVal()
           
 Parameter[] getMembers()
           
 Pointer.Void getParray()
          Deprecated. use getSafeArray() instead.
 SafeArray getParray(VarType vt)
           
 SafeArray getParray(VarType vt, java.lang.Class parameterClass)
           
 Pointer getPboolVal()
           
 Pointer getPbstrVal()
           
 Pointer getPbVal()
           
 Pointer getPcVal()
           
 Pointer getPcyVal()
           
 Pointer getPdate()
           
 Pointer getPdblVal()
           
 Pointer getPdecVal()
           
 IDispatch getPdispVal()
           
 Pointer getPfltVal()
           
 Pointer getPHResultVal()
           
 Pointer getPintVal()
           
 Pointer getPiVal()
           
 Pointer getPllVal()
           
 Pointer getPlVal()
           
 Pointer getPparray()
           
 Pointer getPparray(VarType vt)
           
 Pointer getPparray(VarType vt, java.lang.Class parameterClass)
           
 Pointer getPpdispVal()
           
 Pointer getPpunkVal()
           
 IRecordInfo getPRecInfo()
           
static java.lang.Class getPrimitiveElementType(VarType varType)
          Returns one of JNIWrapper types (classes) that corresponds to the specified VarType.
 Pointer getPscode()
           
 Pointer getPuintVal()
           
 Pointer getPuiVal()
           
 Pointer getPullVal()
           
 Pointer getPulVal()
           
 IUnknown getPunkVal()
           
 Pointer getPvarVal()
           
 Pointer.Void getPvRecord()
           
 SafeArray getSafeArray()
          Returns an instance of the SafeArray, which is stored in this variant.
 SafeArray getSafeArray(java.lang.Class parameterClass)
          Returns an instance of the SafeArray, which is stored in this variant.
 SCode getScode()
           
 UInt getUintVal()
           
 UInt16 getUiVal()
           
 UInt64 getUllVal()
           
 UInt32 getUlVal()
           
 java.lang.Object getValue()
          Gets a value from the variant as instance of JNIWrapper type.
static int getVariantType(java.lang.Class type)
          Returns variant type ID that corresponds to the passed class.
 VarType getVt()
           
 void initBy(Variant that)
           
 boolean isAutoDelete()
           
 void pop(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
           
 void push(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
           
 void read(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
           
protected  void readPerformed()
           
 void release()
          Deprecated. This method is not used any more
 void setActiveMember(Parameter active)
           
 void setActiveMember(Parameter active, boolean read)
           
 void setAutoDelete(boolean autoDelete)
           
 void setBStr(BStr bstr)
           
 void setBStrVal(BStr bstr)
          Deprecated. use setValue(java.lang.Object, int)
 void setSafeArray(SafeArray safeArray)
          Sets the new safe array to this variant.
 void setValue(boolean value)
           
 void setValue(double value)
           
 void setValue(float value)
           
 void setValue(int value)
           
 void setValue(long value)
           
 void setValue(java.lang.Object value)
          Sets a variant value without specifying its type.
 void setValue(java.lang.Object val, int vt)
          Sets new value for the variant.
 java.lang.Object toObject(java.lang.Class type)
          Converts this variant value to a object of specified type.
 void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
           
 
Methods inherited from class com.jniwrapper.Parameter
, a, a, asReturnValue, b, dataBufferAssigned, equals, getAlignedLength, getDataBuffer, getDataBufferOffset, hashCode, indent, read, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNSUPPORTED_TYPE

public static final int UNSUPPORTED_TYPE
See Also:
Constant Field Values

LENGTH

public static final int LENGTH
Constructor Detail

Variant

public Variant()
Creates the new empty instance with VarType.VT_EMPTY type by default.


Variant

public Variant(Variant that)

Variant

public Variant(long value)

Variant

public Variant(int value)

Variant

public Variant(double value)

Variant

public Variant(float value)

Variant

public Variant(boolean value)

Variant

public Variant(java.lang.Object value)

Variant

public Variant(SafeArray array)

Variant

public Variant(VarType type)
Method Detail

getAlignmentRequirement

public int getAlignmentRequirement()

getLlVal

public Int64 getLlVal()

getLVal

public Int32 getLVal()

getBVal

public UInt8 getBVal()

getIVal

public Int16 getIVal()

getFltVal

public SingleFloat getFltVal()

getDblVal

public DoubleFloat getDblVal()

getBoolVal

public VariantBool getBoolVal()

getScode

public SCode getScode()

getCiVal

public CY getCiVal()

getHResultVal

public HResult getHResultVal()

getDate

public Date getDate()

getBstrVal

public BStr getBstrVal()

setBStrVal

public void setBStrVal(BStr bstr)
Deprecated. use setValue(java.lang.Object, int)


getPunkVal

public IUnknown getPunkVal()

getPdispVal

public IDispatch getPdispVal()

getParray

public SafeArray getParray(VarType vt)

getParray

public SafeArray getParray(VarType vt,
                           java.lang.Class parameterClass)

getPbVal

public Pointer getPbVal()

getPiVal

public Pointer getPiVal()

getPlVal

public Pointer getPlVal()

getPllVal

public Pointer getPllVal()

getPfltVal

public Pointer getPfltVal()

getPdblVal

public Pointer getPdblVal()

getPboolVal

public Pointer getPboolVal()

getPscode

public Pointer getPscode()

getPcyVal

public Pointer getPcyVal()

getPHResultVal

public Pointer getPHResultVal()

getPdate

public Pointer getPdate()

getPbstrVal

public Pointer getPbstrVal()

getPpunkVal

public Pointer getPpunkVal()

getPpdispVal

public Pointer getPpdispVal()

getPparray

public Pointer getPparray(VarType vt)

getPparray

public Pointer getPparray(VarType vt,
                          java.lang.Class parameterClass)

getPvarVal

public Pointer getPvarVal()

getByref

public Pointer.Void getByref()

getCVal

public Int8 getCVal()

getUiVal

public UInt16 getUiVal()

getUlVal

public UInt32 getUlVal()

getUllVal

public UInt64 getUllVal()

getIntVal

public Int getIntVal()

getUintVal

public UInt getUintVal()

getPdecVal

public Pointer getPdecVal()

getPcVal

public Pointer getPcVal()

getPuiVal

public Pointer getPuiVal()

getPulVal

public Pointer getPulVal()

getPullVal

public Pointer getPullVal()

getPintVal

public Pointer getPintVal()

getPuintVal

public Pointer getPuintVal()

getPvRecord

public Pointer.Void getPvRecord()

getPRecInfo

public IRecordInfo getPRecInfo()

getLength

public int getLength()

push

public void push(DataBuffer stackBuffer,
                 int offset,
                 boolean invokedByCallback)
          throws MemoryAccessViolationException
Throws:
MemoryAccessViolationException

pop

public void pop(DataBuffer stackBuffer,
                int offset,
                boolean invokedByCallback)
         throws MemoryAccessViolationException
Throws:
MemoryAccessViolationException

write

public void write(DataBuffer stackBuffer,
                  int offset,
                  boolean invokedByCallback)
           throws MemoryAccessViolationException
Throws:
MemoryAccessViolationException

read

public void read(DataBuffer stackBuffer,
                 int offset,
                 boolean invokedByCallback)
          throws MemoryAccessViolationException
Throws:
MemoryAccessViolationException

acceptIOPerformer

public void acceptIOPerformer(IOPerformer performer,
                              DataBuffer buffer,
                              int initialOffset,
                              boolean isReadOperation,
                              boolean invokedByCallback)

setActiveMember

public void setActiveMember(Parameter active)

setActiveMember

public void setActiveMember(Parameter active,
                            boolean read)

getActiveMember

public Parameter getActiveMember()

getMembers

public Parameter[] getMembers()

createUnspecifiedParameter

public static Variant createUnspecifiedParameter()
Creates value for unspecified parameter in dispinterface interface method call.

Returns:
value for unspecified parameter of type VarType.VT_ERROR.
Since:
2.6

initBy

public void initBy(Variant that)

clone

public java.lang.Object clone()

getVt

public VarType getVt()

getParray

public Pointer.Void getParray()
Deprecated. use getSafeArray() instead.


getPparray

public Pointer getPparray()

getDecVal

public Decimal getDecVal()

setValue

public void setValue(java.lang.Object val,
                     int vt)
Sets new value for the variant.

Parameters:
val - new value.
vt - variant type that the passed object represents.
Throws:
java.lang.IllegalArgumentException - if the specified value parameter is not of allowed or specified variant type is not supported.

setValue

public void setValue(long value)

setValue

public void setValue(int value)

setValue

public void setValue(double value)

setValue

public void setValue(float value)

setValue

public void setValue(boolean value)

setValue

public void setValue(java.lang.Object value)
Sets a variant value without specifying its type.

Parameters:
value - value to be assigned to variant

getValue

public java.lang.Object getValue()
Gets a value from the variant as instance of JNIWrapper type.

Returns:
value as JNIWrapper type (com.jniwrapper.Parameter)

getVariantType

public static int getVariantType(java.lang.Class type)
Returns variant type ID that corresponds to the passed class.

Parameters:
type - Object class to get variant type for.
Returns:
one of the values from VarType class or UNSUPPORTED_TYPE if no corresponding type found.

getElementType

public static java.lang.Class getElementType(VarType varType)
Returns one of JNIWrapper types (classes) that corresponds to the specified VarType.

Parameters:
varType - specifies type for which to find JNIWrapper's type
Returns:
one of JNIWrapper types (classes) that corresponds to the specified VarType

getPrimitiveElementType

public static java.lang.Class getPrimitiveElementType(VarType varType)
Returns one of JNIWrapper types (classes) that corresponds to the specified VarType. Removes VT_ARRAY, VT_VECTOR and VT_BYREF flags if they are present

Parameters:
varType - specifies type for which to find JNIWrapper's type
Returns:
one of JNIWrapper types (classes) that corresponds to the specified VarType

setSafeArray

public void setSafeArray(SafeArray safeArray)
Sets the new safe array to this variant.

Parameters:
safeArray - new safe array

setBStr

public void setBStr(BStr bstr)

getSafeArray

public SafeArray getSafeArray()
Returns an instance of the SafeArray, which is stored in this variant.

Returns:
an instance of the SafeArray

getSafeArray

public SafeArray getSafeArray(java.lang.Class parameterClass)
Returns an instance of the SafeArray, which is stored in this variant.

Parameters:
parameterClass - specifies the class of parameters, stored in the variant
Returns:
an instance of the SafeArray

readPerformed

protected void readPerformed()

getDebugInfo

public java.lang.String getDebugInfo()

release

public void release()
Deprecated. This method is not used any more


setAutoDelete

public void setAutoDelete(boolean autoDelete)
Specified by:
setAutoDelete in interface AutoDeleteParameter

isAutoDelete

public boolean isAutoDelete()
Specified by:
isAutoDelete in interface AutoDeleteParameter

getFirstMemberSize

public int getFirstMemberSize()
Specified by:
getFirstMemberSize in interface AlignmentAwareParameter

toObject

public java.lang.Object toObject(java.lang.Class type)
Converts this variant value to a object of specified type. Actual variant value type and expected parameter type must be compatible.

Parameters:
type - expected parameter type
Returns:
value converted variant value