org.jinterop.dcom.core
Class JIArray

java.lang.Object
  extended by org.jinterop.dcom.core.JIArray
All Implemented Interfaces:
java.io.Serializable

public final class JIArray
extends java.lang.Object
implements java.io.Serializable

Represents an Array which can display Conformant\Standard behaviours.
Please make sure you supply completed and final Arrays (of Objects) to this class. Modifying the Array after it has been passed to a JIArray (to subsequently be used in a DCOM call) will have unexpected results.
Please refer to MSExcel examples for more details on how to use this class.

Since:
1.0
See Also:
Serialized Form

Constructor Summary
JIArray(java.lang.Class clazz, int[] upperBounds, int dimension, boolean isConformant)
          Creates an array Object of the type specified by clazz.
JIArray(java.lang.Class clazz, int[] upperBounds, int dimension, boolean isConformant, boolean isVarying)
           Creates an array Object of the type specified by clazz.
JIArray(java.lang.Object array)
          Creates a non conformant array object with array parameter as the nested Array.
JIArray(java.lang.Object array, boolean isConformant)
          Creates an array object with array parameter as the nested Array.
JIArray(java.lang.Object array, boolean isConformant, boolean isVarying)
          Creates an array object with array parameter as the nested Array.
JIArray(java.lang.Object template, int[] upperBounds, int dimension, boolean isConformant)
           Creates an array Object with members of the type template.
JIArray(java.lang.Object template, int[] upperBounds, int dimension, boolean isConformant, boolean isVarying)
           Creates an array Object with members of the type template.
 
Method Summary
 java.lang.Class getArrayClass()
          Class of the nested Array.
 java.lang.Object getArrayInstance()
          Returns the nested Array.
 int getDimensions()
          Returns the dimensions of the Array.
 int[] getUpperBounds()
          Array of integers depicting Highest index for each dimension.
 boolean isConformant()
          Status whether the array is Conformant or not.
 boolean isVarying()
          Status whether the array is Varying or not.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JIArray

public JIArray(java.lang.Class clazz,
               int[] upperBounds,
               int dimension,
               boolean isConformant)

Creates an array Object of the type specified by clazz. This is used to prepare a template for decoding an array of that type. Used only for setting as an OutParam in a JICallObject.
For example:-
This call creates a template for a single dimension Integer array of size 10.
JIArray array = new JIArray(Integer.class,new int[]{10},1,false);

This ctor is invoked when the developer wants to deserialize an array.

Parameters:
clazz - Template for the Array.
upperBounds - Highest index for each dimension.
dimension - Number of dimensions
isConformant - declares whether the array is conformant or not.

JIArray

public JIArray(java.lang.Class clazz,
               int[] upperBounds,
               int dimension,
               boolean isConformant,
               boolean isVarying)

Creates an array Object of the type specified by clazz. This is used to prepare a template for decoding an array of that type. Used only for setting as an OutParam in a JICallObject.
For example:-
This call creates a template for a single dimension Integer array of size 10.
JIArray array = new JIArray(Integer.class,new int[]{10},1,false,false);

This ctor is invoked when the developer wants to deserialize an array.

Parameters:
clazz - Template for the Array.
upperBounds - Highest index for each dimension.
dimension - Number of dimensions
isConformant - declares whether the array is conformant or not.
isVarying - declares whether the array is varying or not.

JIArray

public JIArray(java.lang.Object template,
               int[] upperBounds,
               int dimension,
               boolean isConformant)

Creates an array Object with members of the type template. This API is exclusively for composite types like JIStruct, JIPointer, JIUnion, JIString data types.
Sample Usage:-
JIStruct safeArrayBounds = new JIStruct();
safeArrayBounds.addMember(Integer.class);
safeArrayBounds.addMember(Integer.class);
//arraydesc
JIStruct arrayDesc = new JIStruct();
//typedesc
JIStruct typeDesc = new JIStruct();
arrayDesc.addMember(typeDesc);
arrayDesc.addMember(Short.class);
arrayDesc.addMember(new JIArray(safeArrayBounds,new int[]{1},1,true));

This ctor is invoked when the developer wants to deserialize an array.

Parameters:
template - Can be only of the type JIStruct, JIPointer, JIUnion and JIString
upperBounds - Highest index for each dimension.
dimension - Number of dimensions
isConformant - declares whether the array is conformant or not.

JIArray

public JIArray(java.lang.Object template,
               int[] upperBounds,
               int dimension,
               boolean isConformant,
               boolean isVarying)

Creates an array Object with members of the type template. This API is exclusively for composite types like JIStruct, JIPointer, JIUnion, JIString data types.
Sample Usage:-
JIStruct safeArrayBounds = new JIStruct();
safeArrayBounds.addMember(Integer.class);
safeArrayBounds.addMember(Integer.class);
//arraydesc
JIStruct arrayDesc = new JIStruct();
//typedesc
JIStruct typeDesc = new JIStruct();
arrayDesc.addMember(typeDesc);
arrayDesc.addMember(Short.class);
arrayDesc.addMember(new JIArray(safeArrayBounds,new int[]{1},1,true));

This ctor is invoked when the developer wants to deserialize an array.

Parameters:
template - Can be only of the type JIStruct, JIPointer, JIUnion and JIString
upperBounds - Highest index for each dimension.
dimension - Number of dimensions
isConformant - declares whether the array is conformant or not.
isVarying - declares whether the array is varying or not.

JIArray

public JIArray(java.lang.Object array,
               boolean isConformant)
Creates an array object with array parameter as the nested Array. This ctor is invoked when the developer wants to serialize an array.
Sample Usage:- JIArray array = new JIArray(new JIPointer[]{new JIPointer(name)},true);

Parameters:
array - Array of any type.
isConformant - declares whether the array is conformant or not.

JIArray

public JIArray(java.lang.Object array,
               boolean isConformant,
               boolean isVarying)
Creates an array object with array parameter as the nested Array. This ctor is invoked when the developer wants to serialize an array.
Sample Usage:- JIArray array = new JIArray(new JIPointer[]{new JIPointer(name)},true,true);

Parameters:
array - Array of any type.
isConformant - declares whether the array is conformant or not.
isVarying - declares whether the array is varying or not.

JIArray

public JIArray(java.lang.Object array)
Creates a non conformant array object with array parameter as the nested Array. This ctor is invoked when the developer wants to serialize an array.
Sample Usage:- JIArray array = new JIArray(new Integer[]{new Integer(1)});

Parameters:
array - Array of any type.
Method Detail

getArrayInstance

public java.lang.Object getArrayInstance()
Returns the nested Array.

Returns:
array Object (type cast based on class).

getArrayClass

public java.lang.Class getArrayClass()
Class of the nested Array.

Returns:

getUpperBounds

public int[] getUpperBounds()
Array of integers depicting Highest index for each dimension.

Returns:

getDimensions

public int getDimensions()
Returns the dimensions of the Array.

Returns:

isConformant

public boolean isConformant()
Status whether the array is Conformant or not.

Returns:
true is array is conformant.

isVarying

public boolean isVarying()
Status whether the array is Varying or not.

Returns:
true is array is Varying.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object