Class protocol_class = Class.forName("com.sun.star.lib.uno.protocols." + protocolDescription + "." + protocolDescription);
Constructor protocol_constructor = protocol_class.getConstructor(new Class[] {IBridge.class});
IProtocol iProtocol = (IProtocol)protocol_constructor.newInstance(new Object[]{testBridge});
IMarshal iMarshal = iProtocol.createMarshal();
TestObject testObject = new TestObject();
test.PrimitiveSeqStruct x = new test.PrimitiveSeqStruct();
x.zAny = new Object[]{new Integer(1), new Double(2) };
Object data[] = new Object[] {
new com.sun.star.uno.RuntimeException("testRuntimeException"),
new com.sun.star.uno.Exception("testException"),
new Boolean(true),
new Byte((byte)47),
new Character('k'),
new Double(0.12345),
test.BEnum.B,
new Float(0.5678),
new Integer(0),
new Integer(128),
new Integer(0x0f00),
new Integer(0x0f0000),
new Integer(0x0f000000),
new Integer(-128),
new Integer(0xff00),
new Integer(0xff0000),
new Integer(0xff000000),
new Long(666L),
new Short((short)444),
new String("blabla"),
new Integer(10), // Any as object
new Integer(10), // Any as object
new Any(new Type(Integer.class), new Integer(10)), // Any as Any
new Any(new Type(Integer.class), new Integer(10)), // Any as Any
null,
new test.PrimitiveStruct(),
x, //new test.PrimitiveSeqStruct(),
new byte[]{1,2,3,4,5,6,7}, // primitive sequence
new int[]{7,6,5,4,3,2,1}, // primitive sequence
new Object[]{new Integer(123), new String("hallo")}, // any sequence
new test.PrimitiveStruct[]{new test.PrimitiveStruct(), new test.PrimitiveStruct()}, // sequence of primitive structs
new test.PrimitiveSeqStruct[]{new test.PrimitiveSeqStruct(), new test.PrimitiveSeqStruct()}, // sequence of primitive structs
new test.NestedStruct(),
new test.NestedSeqStruct(),
new Type(Void.class),
new Type(String.class),
new Type(Object.class),
new Type(Byte.class),
new Type(Integer.class),
new Type(Double.class),
new Type(Float.class),
new Type(Character.class),
new Type(Short.class),
new Type(Boolean.class),
new Type(void.class),
new Type(byte.class),
new Type(int.class),
new Type(double.class),
new Type(float.class),
new Type(char.class),
new Type(short.class),
new Type(boolean.class),
new Type(Class.forName("[Ljava.lang.String;")),
new Type(Class.forName("[Ljava.lang.Object;")),
new Type(Class.forName("[B")),
new Type(Class.forName("[Z")),
new Type("boolean"),
new Type("byte"),
new Type("char"),
new Type("short"),
new Type("long"),
new Type("hyper"),
new Type("float"),
new Type("double"),
new Type("string"),
new Type("void"),
new Type("any"),
new Type("test.BEnum"),
new Type("[]boolean"),
new Type("[][]byte"),
new Type("[][][]char"),
new Type("[][][][]short"),
new Type("[][][][][]any"),
new Type("com.sun.star.uno.XInterface"),
new Type("[]com.sun.star.uno.XInterface"),
testObject,
testObject,
new test.InterfaceStruct(testObject, null)
};
ITypeDescription dataTypes[] = new ITypeDescription[] {
TypeDescription.getTypeDescription(com.sun.star.uno.RuntimeException.class),
TypeDescription.getTypeDescription(com.sun.star.uno.Exception.class),
TypeDescription.getTypeDescription(Boolean.class),
TypeDescription.getTypeDescription(Byte.class),
TypeDescription.getTypeDescription(Character.class),
TypeDescription.getTypeDescription(Double.class),
TypeDescription.getTypeDescription(test.BEnum.class),
TypeDescription.getTypeDescription(Float.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Integer.class),
TypeDescription.getTypeDescription(Long.class),
TypeDescription.getTypeDescription(Short.class),
TypeDescription.getTypeDescription(String.class),
TypeDescription.getTypeDescription(Object.class),
TypeDescription.getTypeDescription(Any.class),
TypeDescription.getTypeDescription(Any.class),
TypeDescription.getTypeDescription(Object.class),
TypeDescription.getTypeDescription(XInterface.class),
TypeDescription.getTypeDescription(test.PrimitiveStruct.class),
TypeDescription.getTypeDescription(test.PrimitiveSeqStruct.class),
TypeDescription.getTypeDescription(Class.forName("[B")),
TypeDescription.getTypeDescription(Class.forName("[I")),
TypeDescription.getTypeDescription(Class.forName("[Lcom.sun.star.uno.Any;")),
TypeDescription.getTypeDescription(Class.forName("[Ltest.PrimitiveStruct;")),
TypeDescription.getTypeDescription(Class.forName("[Ltest.PrimitiveSeqStruct;")),
TypeDescription.getTypeDescription(test.NestedStruct.class),
TypeDescription.getTypeDescription(test.NestedSeqStruct.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(Type.class),
TypeDescription.getTypeDescription(XInterface.class),
TypeDescription.getTypeDescription(XInterface.class),
TypeDescription.getTypeDescription(test.InterfaceStruct.class),
};
for(int i = 0; i < dataTypes.length; ++ i) {
Object op1 = data[i];
iMarshal.writeObject(dataTypes[i], data[i]);
IUnmarshal iUnmarshal = iProtocol.createUnmarshal(iMarshal.reset());
Object op2 = iUnmarshal.readObject(dataTypes[i]);
if(op1 instanceof Any)
op1 = ((Any)op1).getObject();