|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jinterop.dcom.core.JIVariant
public final class JIVariant
Class representing the VARIANT
datatype.
Please use the byRef
flag based constructors for by reference
parameters in COM calls. For [optional]
parameters use the
OPTIONAL_PARAM()
In case of direct calls to COM server using JICallBuilder
, if the byRef
flag is set then
that variant should also be added as the [out]
parameter in the JICallBuilder
.
For developers using the IJIDispatch
this is not required and variant would be returned back to them
via JIVariant[]
associated with IJIDispatch
apis.
An important note for Boolean
Arrays (JIArray
of Boolean
),
please set the JIFlag.FLAG_REPRESENTATION_VARIANT_BOOL
using the setFlag(int)
method before making a call on this object. This is required since in DCOM , VARIANT_BOOL
are 2 bytes
and standard boolean
s are 1 byte in length.
Field Summary | |
---|---|
static int |
FADF_AUTO
|
static int |
FADF_BSTR
|
static int |
FADF_DISPATCH
|
static int |
FADF_EMBEDDED
|
static int |
FADF_FIXEDSIZE
|
static int |
FADF_HAVEIID
|
static int |
FADF_HAVEVARTYPE
|
static int |
FADF_RECORD
|
static int |
FADF_RESERVED
|
static int |
FADF_STATIC
|
static int |
FADF_UNKNOWN
|
static int |
FADF_VARIANT
|
static org.jinterop.dcom.core.JIVariant.SCODE |
SCODE
SCODE VARIANT |
static int |
VT_ARRAY
|
static int |
VT_BOOL
|
static int |
VT_BSTR
|
static int |
VT_BYREF
|
static int |
VT_BYREF_VT_ARRAY
|
static int |
VT_BYREF_VT_BOOL
|
static int |
VT_BYREF_VT_BSTR
|
static int |
VT_BYREF_VT_CY
|
static int |
VT_BYREF_VT_DATE
|
static int |
VT_BYREF_VT_DECIMAL
|
static int |
VT_BYREF_VT_DISPATCH
|
static int |
VT_BYREF_VT_ERROR
|
static int |
VT_BYREF_VT_I1
|
static int |
VT_BYREF_VT_I2
|
static int |
VT_BYREF_VT_I4
|
static int |
VT_BYREF_VT_I8
|
static int |
VT_BYREF_VT_INT
|
static int |
VT_BYREF_VT_R4
|
static int |
VT_BYREF_VT_R8
|
static int |
VT_BYREF_VT_UI1
|
static int |
VT_BYREF_VT_UI2
|
static int |
VT_BYREF_VT_UI4
|
static int |
VT_BYREF_VT_UINT
|
static int |
VT_BYREF_VT_UNKNOWN
|
static int |
VT_BYREF_VT_VARIANT
|
static int |
VT_CY
|
static int |
VT_DATE
|
static int |
VT_DECIMAL
|
static int |
VT_DISPATCH
|
static int |
VT_EMPTY
|
static int |
VT_ERROR
|
static int |
VT_I1
|
static int |
VT_I2
|
static int |
VT_I4
|
static int |
VT_I8
|
static int |
VT_INT
|
static int |
VT_NULL
|
static int |
VT_R4
|
static int |
VT_R8
|
static int |
VT_UI1
|
static int |
VT_UI2
|
static int |
VT_UI4
|
static int |
VT_UINT
|
static int |
VT_UNKNOWN
|
static int |
VT_VARIANT
|
Constructor Summary | |
---|---|
JIVariant(boolean value)
Setting up a VARIANT with a boolean . |
|
JIVariant(boolean value,
boolean isByRef)
Setting up a VARIANT with a boolean . |
|
JIVariant(char value)
Setting up a VARIANT with a char . |
|
JIVariant(char value,
boolean isByRef)
Setting up a VARIANT with a char . |
|
JIVariant(java.util.Date value)
Setting up a VARIANT with an java.util.Date . |
|
JIVariant(java.util.Date value,
boolean isByRef)
Setting up a VARIANT with an java.util.Date . |
|
JIVariant(double value)
Setting up a VARIANT with a double . |
|
JIVariant(double value,
boolean isByRef)
Setting up a VARIANT with a double . |
|
JIVariant(float value)
Setting up a VARIANT with a float . |
|
JIVariant(float value,
boolean isByRef)
Setting up a VARIANT with a float . |
|
JIVariant(IJIComObject value)
Setting up a VARIANT with an IJIComObject . |
|
JIVariant(IJIComObject value,
boolean isByRef)
Setting up a VARIANT with an IJIComObject . |
|
JIVariant(IJIUnsigned number)
Setting up a VARIANT with a unsigned value. |
|
JIVariant(IJIUnsigned number,
boolean isByRef)
Setting up a VARIANT with a unsigned value. |
|
JIVariant(int value)
Setting up a VARIANT with an int . |
|
JIVariant(int value,
boolean isByRef)
Setting up a VARIANT with an int . |
|
JIVariant(JIArray array)
Setting up a VARIANT with a JIArray . |
|
JIVariant(JIArray array,
boolean isByRef)
Setting up a VARIANT with a JIArray . |
|
JIVariant(JIArray array,
boolean isByRef,
int FLAG)
Setting up a VARIANT with a JIArray . |
|
JIVariant(JIArray array,
int FLAG)
Setting up a VARIANT with a JIArray . |
|
JIVariant(JICurrency value)
Setting up a VARIANT with a JICurrency . |
|
JIVariant(JICurrency value,
boolean isByRef)
Setting up a VARIANT with a JICurrency . |
|
JIVariant(JIString value)
Setting up a VARIANT with a JIString . |
|
JIVariant(JIString value,
boolean isByRef)
Setting up a VARIANT with a JIString . |
|
JIVariant(org.jinterop.dcom.core.JIVariant.SCODE value,
int errorCode)
Setting up a VARIANT with a SCODE value and it's errorCode . |
|
JIVariant(org.jinterop.dcom.core.JIVariant.SCODE value,
int errorCode,
boolean isByRef)
Setting up a VARIANT with a SCODE value and it's errorCode . |
|
JIVariant(JIVariant variant)
Setting up a VARIANT as reference to another. |
|
JIVariant(long value,
boolean isByRef)
Setting up a VARIANT with a long . |
|
JIVariant(short value)
Setting up a VARIANT with a short . |
|
JIVariant(short value,
boolean isByRef)
Setting up a VARIANT with a short . |
|
JIVariant(java.lang.String value)
Setting up a VARIANT with a String . |
|
JIVariant(java.lang.String value,
boolean isByRef)
Setting up a VARIANT with a String . |
Method Summary | |
---|---|
static JIVariant |
BSTRARRAY()
Helper method for creating an array of BSTR s , IDL signature [in, out] SAFEARRAY(BSTR) *p . |
static JIVariant |
EMPTY_BYREF()
EMPTY BYREF VARIANT . |
static JIVariant |
EMPTY()
EMPTY VARIANT . |
int |
getFlag()
Returns the flag value for this variant. |
java.lang.Object |
getObject()
Returns the contained object. |
JIArray |
getObjectAsArray()
Retrieves the contained object as JIArray . |
boolean |
getObjectAsBoolean()
Retrieves the contained object as boolean . |
char |
getObjectAsChar()
Retrieves the contained object as char . |
IJIComObject |
getObjectAsComObject()
Retrieves the contained object as IJIComObject . |
java.util.Date |
getObjectAsDate()
Retrieves the contained object as java.util.Date . |
double |
getObjectAsDouble()
Retrieves the contained object as double . |
float |
getObjectAsFloat()
Retrieves the contained object as float . |
int |
getObjectAsInt()
Retrieves the contained object as int . |
long |
getObjectAsLong()
Retrieves the contained object as long , used when the expected type is VT_I8. |
int |
getObjectAsSCODE()
Retrieves the contained objects errorCode. |
short |
getObjectAsShort()
Retrieves the contained object as short . |
JIString |
getObjectAsString()
Retrieves the contained object as JIString . |
java.lang.String |
getObjectAsString2()
Retrieves the contained object as String . |
IJIUnsigned |
getObjectAsUnsigned()
Retrieves the contained object as unsigned number. |
JIVariant |
getObjectAsVariant()
Retrieves the contained object as JIVariant . |
int |
getType()
Returns the referent as integer. |
boolean |
isArray()
|
boolean |
isByRefFlagSet()
|
boolean |
isNull()
Returns whether this variant is a NULL variant. |
static JIVariant |
makeVariant(java.lang.Object o)
Returns a JIVariant (of the right type) based on the o.getClass() |
static JIVariant |
makeVariant(java.lang.Object o,
boolean isByRef)
Returns a JIVariant (of the right type) based on the o.getClass() |
static JIVariant |
NULL()
NULL VARIANT . |
static JIVariant |
OPTIONAL_PARAM()
OPTIONAL PARAM. |
static JIVariant |
OUT_IDISPATCH()
VARIANT for ([out] IDispatch*) . |
static JIVariant |
OUT_IUNKNOWN()
VARIANT for ([out] IUnknown*) . |
static JIVariant |
OUTPARAMforType(java.lang.Class c,
boolean isArray)
|
void |
setFlag(int FLAG)
Sets a JIFlags value to be used while encoding (marshalling) this Variant. |
java.lang.String |
toString()
|
static JIVariant |
VARIANTARRAY()
Helper method for creating an array of VARIANT s , IDL signature [in, out] SAFEARRAY(VARIANT) *p
OR [in,out] VARIANT *pArray . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int VT_NULL
public static final int VT_EMPTY
public static final int VT_I4
public static final int VT_UI1
public static final int VT_I2
public static final int VT_R4
public static final int VT_R8
public static final int VT_VARIANT
public static final int VT_BOOL
public static final int VT_ERROR
public static final int VT_CY
public static final int VT_DATE
public static final int VT_BSTR
public static final int VT_UNKNOWN
public static final int VT_DECIMAL
public static final int VT_DISPATCH
public static final int VT_ARRAY
public static final int VT_BYREF
public static final int VT_BYREF_VT_UI1
public static final int VT_BYREF_VT_I2
public static final int VT_BYREF_VT_I4
public static final int VT_BYREF_VT_R4
public static final int VT_BYREF_VT_R8
public static final int VT_BYREF_VT_BOOL
public static final int VT_BYREF_VT_ERROR
public static final int VT_BYREF_VT_CY
public static final int VT_BYREF_VT_DATE
public static final int VT_BYREF_VT_BSTR
public static final int VT_BYREF_VT_UNKNOWN
public static final int VT_BYREF_VT_DISPATCH
public static final int VT_BYREF_VT_ARRAY
public static final int VT_BYREF_VT_VARIANT
public static final int VT_I1
public static final int VT_UI2
public static final int VT_UI4
public static final int VT_I8
public static final int VT_INT
public static final int VT_UINT
public static final int VT_BYREF_VT_DECIMAL
public static final int VT_BYREF_VT_I1
public static final int VT_BYREF_VT_UI2
public static final int VT_BYREF_VT_UI4
public static final int VT_BYREF_VT_I8
public static final int VT_BYREF_VT_INT
public static final int VT_BYREF_VT_UINT
public static final int FADF_AUTO
public static final int FADF_STATIC
public static final int FADF_EMBEDDED
public static final int FADF_FIXEDSIZE
public static final int FADF_RECORD
public static final int FADF_HAVEIID
public static final int FADF_HAVEVARTYPE
public static final int FADF_BSTR
public static final int FADF_UNKNOWN
public static final int FADF_DISPATCH
public static final int FADF_VARIANT
public static final int FADF_RESERVED
public static final org.jinterop.dcom.core.JIVariant.SCODE SCODE
VARIANT
Constructor Detail |
---|
public JIVariant(JIVariant variant)
VARIANT
as reference to another. Used via serializing the VARIANT
.
variant
- public JIVariant(int value, boolean isByRef)
VARIANT
with an int
. Used via serializing the VARIANT
.
Used when the variant type is VT_I4.
value
- isByRef
- true
if the value is to be represented as a pointer. LONG*public JIVariant(long value, boolean isByRef)
VARIANT
with a long
. Used via serializing the VARIANT
.
Used when the variant type is VT_I8.
value
- isByRef
- true
if the value is to be represented as a pointer.public JIVariant(float value, boolean isByRef)
VARIANT
with a float
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. FLOAT*public JIVariant(boolean value, boolean isByRef)
VARIANT
with a boolean
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. VARIANT_BOOL*public JIVariant(double value, boolean isByRef)
VARIANT
with a double
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. DOUBLE*public JIVariant(short value, boolean isByRef)
VARIANT
with a short
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. SHORT*public JIVariant(char value, boolean isByRef)
VARIANT
with a char
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. CHAR*public JIVariant(JIString value, boolean isByRef)
VARIANT
with a JIString
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. BSTR*public JIVariant(java.lang.String value, boolean isByRef)
VARIANT
with a String
. Used via serializing the VARIANT
. Internally a
JIString
is formed with it's default type BSTR
.
value
- isByRef
- true
if the value is to be represented as a pointer. BSTR*public JIVariant(java.lang.String value)
VARIANT
with a String
. Used via serializing the VARIANT
. Internally a
JIString
is formed with it's default type BSTR
.
value
- public JIVariant(IJIComObject value, boolean isByRef)
VARIANT
with an IJIComObject
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. IJIComObject**public JIVariant(org.jinterop.dcom.core.JIVariant.SCODE value, int errorCode, boolean isByRef)
VARIANT
with a SCODE
value and it's errorCode
. Used via serializing the VARIANT
.
value
- errorCode
- isByRef
- true
if the value is to be represented as a pointer. SCODE*public JIVariant(int value)
VARIANT
with an int
. Used via serializing the VARIANT
.
value
- public JIVariant(float value)
VARIANT
with a float
. Used via serializing the VARIANT
.
value
- public JIVariant(boolean value)
VARIANT
with a boolean
. Used via serializing the VARIANT
.
value
- public JIVariant(double value)
VARIANT
with a double
. Used via serializing the VARIANT
.
value
- public JIVariant(short value)
VARIANT
with a short
. Used via serializing the VARIANT
.
value
- public JIVariant(char value)
VARIANT
with a char
. Used via serializing the VARIANT
.
value
- public JIVariant(JIString value)
VARIANT
with a JIString
. Used via serializing the VARIANT
.
value
- public JIVariant(IJIComObject value)
VARIANT
with an IJIComObject
. Used via serializing the VARIANT
.
value
- public JIVariant(java.util.Date value)
VARIANT
with an java.util.Date
. Used via serializing the VARIANT
.
value
- public JIVariant(java.util.Date value, boolean isByRef)
VARIANT
with an java.util.Date
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. Date*public JIVariant(JICurrency value)
VARIANT
with a JICurrency
. Used via serializing the VARIANT
.
value
- public JIVariant(JICurrency value, boolean isByRef)
VARIANT
with a JICurrency
. Used via serializing the VARIANT
.
value
- isByRef
- true
if the value is to be represented as a pointer. JICurrency*public JIVariant(org.jinterop.dcom.core.JIVariant.SCODE value, int errorCode)
VARIANT
with a SCODE
value and it's errorCode
. Used via serializing the VARIANT
.
value
- errorCode
- public JIVariant(JIArray array, int FLAG)
VARIANT
with a JIArray
. Used via serializing the VARIANT
.
Only 1 and 2 dimensional array is supported.
array
- FLAG
- JIFlag valuepublic JIVariant(JIArray array, boolean isByRef, int FLAG)
VARIANT
with a JIArray
. Used via serializing the VARIANT
.
Only 1 and 2 dimensional array is supported.
array
- isByRef
- FLAG
- JIFlag valuepublic JIVariant(JIArray array, boolean isByRef)
VARIANT
with a JIArray
. Used via serializing the VARIANT
.
Only 1 and 2 dimensional array is supported.
array
- isByRef
- public JIVariant(JIArray array)
VARIANT
with a JIArray
. Used via serializing the VARIANT
.
array
- public JIVariant(IJIUnsigned number)
VARIANT
with a unsigned
value. Used via serializing the VARIANT
.
number
- public JIVariant(IJIUnsigned number, boolean isByRef)
VARIANT
with a unsigned
value. Used via serializing the VARIANT
.
number
- isByRef
- true
if the value is to be represented as a pointer.Method Detail |
---|
public static JIVariant OUTPARAMforType(java.lang.Class c, boolean isArray)
public static JIVariant makeVariant(java.lang.Object o)
o.getClass()
o
-
public static JIVariant makeVariant(java.lang.Object o, boolean isByRef)
o.getClass()
o
- isByRef
-
public static JIVariant EMPTY()
VARIANT
. This is not Thread Safe , hence a new instance must be taken each time.
public static JIVariant EMPTY_BYREF()
VARIANT
. This is not Thread Safe , hence a new instance must be taken each time. Used for a
[out] VARIANT*
.
public static JIVariant OUT_IUNKNOWN()
VARIANT
for ([out] IUnknown*)
. This is not Thread Safe , hence a new instance must be taken each time.
public static JIVariant OUT_IDISPATCH()
VARIANT
for ([out] IDispatch*)
. This is not Thread Safe , hence a new instance must be taken each time.
IDispatch
i.e. supports automation (or is a
dispinterface
).
public static JIVariant NULL()
VARIANT
. This is not Thread Safe , hence a new instance must be taken each time.
public static JIVariant OPTIONAL_PARAM()
[optional]
for a COM call.
This is not Thread Safe , hence a new instance must be taken each time.
public static JIVariant BSTRARRAY()
BSTR
s , IDL signature [in, out] SAFEARRAY(BSTR) *p
.
The return value can directly be used in an IJIDispatch
call.
public static JIVariant VARIANTARRAY()
VARIANT
s , IDL signature [in, out] SAFEARRAY(VARIANT) *p
OR [in,out] VARIANT *pArray
. The return value can directly be used in an IJIDispatch
call.
public void setFlag(int FLAG)
JIFlags
value to be used while encoding (marshalling) this Variant.
FLAG
- public int getFlag()
public boolean isNull()
NULL
variant.
true
if the variant is a NULL
public java.lang.Object getObject() throws JIException
JIException
public int getObjectAsInt() throws JIException
int
.
JIException
public float getObjectAsFloat() throws JIException
float
.
JIException
public int getObjectAsSCODE() throws JIException
JIException
public double getObjectAsDouble() throws JIException
double
.
JIException
public short getObjectAsShort() throws JIException
short
.
JIException
public boolean getObjectAsBoolean() throws JIException
boolean
.
JIException
public JIString getObjectAsString() throws JIException
JIString
.
JIException
public java.lang.String getObjectAsString2() throws JIException
String
.
JIException
public java.util.Date getObjectAsDate() throws JIException
java.util.Date
.
JIException
public char getObjectAsChar() throws JIException
char
.
JIException
public IJIComObject getObjectAsComObject() throws JIException
IJIComObject
. Return value must be "narrowed" to get the expected type.
for example :- If expected type is an IJIDispatch
,
then the return value must pass through JIObjectFactory.narrowInstance(IJIComObject)
to get to the right type.
JIException
public JIVariant getObjectAsVariant() throws JIException
JIVariant
.
JIException
public JIArray getObjectAsArray() throws JIException
JIArray
. Only 1 and 2 dim arrays are supported currently.
Please note that this array is not backed by this variant and is a new copy. If the array
is IJIComObject
s, please make sure to use JIObjectFactory.narrowObject()
to
get the right instance.
JIException
public long getObjectAsLong() throws JIException
long
, used when the expected type is VT_I8.
JIException
public IJIUnsigned getObjectAsUnsigned() throws JIException
unsigned
number.
JIException
public boolean isArray() throws JIException
JIException
public boolean isByRefFlagSet() throws JIException
JIException
public int getType() throws JIException
JIVariant.VT_XX
flags to find out the type of the referent.
For example :-
switch(variant.getType())
{
case JIVariant.VT_VARIANT: value = variant.getObjectAsVariant();
break;
case JIVariant.VT_NULL: ...
break;
}
JIException
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |