|
ReportMill 12 API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.reportmill.base.RMXMLWriter
public class RMXMLWriter
This class turns any Java dataset into XML. The most common use of this class is simply the writeObject() method, which takes a Java dataset and results in a very clean XML description (at the given path):
new RMXMLWriter().writeObject(myObjects, "MyDataset.xml");
The Java dataset can take almost any form: a list, map or hierarchy of EJBs, custom Java classes, Java collections classes or even JDBC ResultSets. The resulting XML file is a very clean description of all the public fields, methods and keys/values in the dataset (out to three levels deep, which is the default "degree of separation").
This code currently supports entity subclasses (eg, Vehicle->Car, Vehicle->Truck) by folding them into their base class (eg, Vehicle). A future version might consider building an RMSchema that includes an entity "parent" attribute, so that a hierarchy of entities could be mapped instead of just a list. Subtype's would then refer to the base class for a given relation, and each member of the relation would have to specify its "Class" if different from base.
| Field Summary | |
|---|---|
static java.lang.String |
TAG_ID
|
| Constructor Summary | |
|---|---|
RMXMLWriter()
Creates a new xml writer. |
|
| Method Summary | |
|---|---|
int |
getPropertyNextUniqueID(RMProperty aProperty)
Returns the next unique id for given property. |
RMSchema |
getSchema()
Returns the schema. |
com.reportmill.archiver.RXElement |
getXML(java.lang.Object anObj,
java.lang.Object userInfo,
int degreeOfSeparation)
Returns an xml RXElement tree for given Java dataset and optional userInfo, out to given degree of separation. |
com.reportmill.archiver.RXElement |
getXML(java.lang.Object anObj,
RMSchema aSchema,
int aDegreeOfSeparation)
Returns an element tree for given collections map and schema. |
void |
ignoreClass(java.lang.Class aClass)
Tells writer to ignore any member of the given class from the serialized object graph. |
void |
ignoreClass(java.lang.String aClassName)
Tells writer to ignore any member of the given class name from the serialized object graph. |
void |
ignoreMember(java.lang.Class aClass,
java.lang.String aFieldName)
Tells writer to ignore any member with the given class - member combination. |
void |
ignoreMember(java.lang.String aFieldName)
Tells writer to ignore any member with the given method/field name from the serialized object graph. |
void |
ignoreMember(java.lang.String aClassName,
java.lang.String aFieldName)
Tells writer to ignore any member with the given classname - member combination. |
void |
writeObject(java.lang.Object anObj,
java.lang.Object userInfo,
java.lang.String aPath,
int degreeOfSeparation)
Writes given Java dataset and optional userInfo to given path as XML, out to given degree of separation. |
void |
writeObject(java.lang.Object anObj,
java.lang.String aPath)
Writes given Java dataset to given path as XML, out to three levels deep, which is default degree of separation. |
void |
writeObject(java.lang.Object anObj,
java.lang.String aPath,
int dos)
Writes given Java dataset to given path as XML, out to given degree of separation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TAG_ID
| Constructor Detail |
|---|
public RMXMLWriter()
| Method Detail |
|---|
public void ignoreClass(java.lang.Class aClass)
public void ignoreClass(java.lang.String aClassName)
public void ignoreMember(java.lang.String aFieldName)
public void ignoreMember(java.lang.Class aClass,
java.lang.String aFieldName)
public void ignoreMember(java.lang.String aClassName,
java.lang.String aFieldName)
public void writeObject(java.lang.Object anObj,
java.lang.String aPath)
public void writeObject(java.lang.Object anObj,
java.lang.String aPath,
int dos)
public void writeObject(java.lang.Object anObj,
java.lang.Object userInfo,
java.lang.String aPath,
int degreeOfSeparation)
public com.reportmill.archiver.RXElement getXML(java.lang.Object anObj,
java.lang.Object userInfo,
int degreeOfSeparation)
public com.reportmill.archiver.RXElement getXML(java.lang.Object anObj,
RMSchema aSchema,
int aDegreeOfSeparation)
public RMSchema getSchema()
public int getPropertyNextUniqueID(RMProperty aProperty)
|
ReportMill 12 API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||