Re: [Simple-support] How to add support for Object[] to a Transform?
Brought to you by:
niallg
|
From: Marco L. <mar...@ya...> - 2011-09-28 20:36:58
|
Ok, I made some tests, don't know if I found a bug. The code below fires a NPE at TestStrategy.java:191
This is my case: an array of object where each element can be an Object so even a Object[].
After this I will try to figure out how to serialize this structure. Thx.
Mar
------------------------------ TestObject start ----------------------------------
import java.io.File;
import org.simpleframework.xml.ElementArray;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
@Root
public class TestObject {
@ElementArray
private Object[] values = null;
public TestObject(Object[] values) {
this.values = values;
}
public static void main(String[] args) {
Object[] value1 = new Object[] {
new Object[]{new Object[]{"ref1"}, "v1"}
, new Object[]{new Object[]{"ref2"}, "v2"}
};
TestObject testObject = new TestObject(value1);
Serializer serializer = new Persister();
File result = new File("/tmp/example.xml");
try {
serializer.write(testObject, result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------ TestObject end ----------------------------------
----- Original Message -----
From: Marco LOMBARDO <mar...@ya...>
To: "sim...@li..." <sim...@li...>
Cc:
Sent: Wednesday, September 28, 2011 12:41 AM
Subject: [Simple-support] How to add support for Object[] to a Transform?
I have a collection of value coming from a database, the generic record should be used for more than one table.
So I decide to use a Object[] to load values. But seems that this is not suported.
The problem is a bit more complicated: some value of the Object[] are Object[].
There is a way to add this Transform/Visitor?
Thx.
Mar
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|