Package com.ribs
Class RXArchiver
- java.lang.Object
- 
- com.ribs.RXArchiver
 
- 
- Direct Known Subclasses:
- RibsArchiver
 
 public class RXArchiver extends java.lang.ObjectThis class manages archival and unarchival to/from RXElements.For archival, objects simply implement the toXML() method to configure and return RXElements. RXArchiver's toXML() method manages the process, allowing for object references. For unarchival, classes register for particular element names. Then during RXArchiver.fromXML(), RXArchiver will call fromXML() on the classes for encountered tags to reconstruct the object graph. Copyright (c) 2004 ReportMill Software, Inc. All Rights Reserved. Contact ReportMill . 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classRXArchiver.ResourceThis inner class represents a named resource associated with an archiver.
 - 
Constructor SummaryConstructors Constructor Description RXArchiver()Creates a new archiver.RXArchiver(java.util.Map classMap)Creates an archiver with the given class map for unarchival class mapping.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParent(java.lang.Object aParent, RXElement anElement)Adds a parent to the parent list.java.lang.StringaddResource(byte[] bytes, java.lang.String aName)Adds a byte array resource to this archiver (only if absent).java.lang.ObjectfromXML(RXElement anElement)Returns an object unarchived from the given element.java.lang.ObjectfromXML(RXElement anElement, java.lang.Class aClass)Returns an object unarchived from the given element by instanciating the given class.java.lang.ObjectfromXML(java.lang.Object aSource)Returns a root object unarchived from the XML source (a File, String path, InputStream, URL, byte[], etc.).protected java.lang.ObjectfromXML(java.lang.Object anObj, RXElement anElement)Calls fromXML on given object.java.lang.Objectget(java.lang.Class aClass, RXElement anElement)Returns the first object of the given class from the given element.java.lang.Objectget(java.lang.String aName, RXElement anElement)Returns the named object unarchived from the given element.java.lang.Objectget(java.lang.String aName, RXElement anElement, java.lang.Object defaultValue)Returns the named object unarchived from the given element (or, if missing, the given default value).java.util.ListgetList(java.lang.Class aClass, RXElement anElement)Returns the list of objects of the given class unarchived from the given element.java.util.ListgetList(java.lang.String aName, RXElement anElement)Returns the list of objects with the given name unarchived from given element.java.util.ListgetList(java.lang.String aName, RXElement anElement, java.lang.Class aClass, java.util.List defaultList)Returns the list of objects with the given name unarchived from given element instanciated from given class.java.util.ListgetList(java.lang.String aName, RXElement anElement, java.util.List defaultList)Returns the list of objects with the given name unarchived from given element (or, if missing, given default).java.lang.ObjectgetParent()Returns parent object that initiated unarchival for current object (valid inside that object's fromXML method).intgetReference(java.lang.Object anObj)Returns a reference id for the given object (used in archival).intgetReference(java.lang.Object anObj, boolean add)Returns a reference id for given object if in references list with option to add if absent (used in archival).java.lang.ObjectgetReference(java.lang.String aName, RXElement anElement)Returns an object for a given reference (used in unarchival).RXArchiver.ResourcegetResource(int anIndex)Returns an individual resource associated with this archiver, by index.byte[]getResource(java.lang.String aName)Returns an individual resource associated with this archiver, by name.java.util.ListgetResources()Returns the list of optional resources associated with this archiver.protected java.lang.ObjectnewInstance(RXElement anElement, java.lang.Class aClass)Returns a new instance of an object given an element and suggested class (probably null).voidreplace(java.lang.Object obj1, java.lang.Object obj2)Called when a fromXML method swaps another object in to replace the one unarchiving.RXElementtoXML(java.lang.Object anObj)Writes the given object to XML elements.
 
- 
- 
- 
Method Detail- 
toXMLpublic RXElement toXML(java.lang.Object anObj) Writes the given object to XML elements.
 - 
fromXMLpublic java.lang.Object fromXML(java.lang.Object aSource) Returns a root object unarchived from the XML source (a File, String path, InputStream, URL, byte[], etc.).
 - 
fromXMLpublic java.lang.Object fromXML(RXElement anElement) Returns an object unarchived from the given element.
 - 
fromXMLpublic java.lang.Object fromXML(RXElement anElement, java.lang.Class aClass) Returns an object unarchived from the given element by instanciating the given class.
 - 
newInstanceprotected java.lang.Object newInstance(RXElement anElement, java.lang.Class aClass) Returns a new instance of an object given an element and suggested class (probably null).
 - 
fromXMLprotected java.lang.Object fromXML(java.lang.Object anObj, RXElement anElement)Calls fromXML on given object.
 - 
getpublic java.lang.Object get(java.lang.String aName, RXElement anElement)Returns the named object unarchived from the given element.
 - 
getpublic java.lang.Object get(java.lang.String aName, RXElement anElement, java.lang.Object defaultValue)Returns the named object unarchived from the given element (or, if missing, the given default value).
 - 
getpublic java.lang.Object get(java.lang.Class aClass, RXElement anElement)Returns the first object of the given class from the given element.
 - 
getListpublic java.util.List getList(java.lang.String aName, RXElement anElement)Returns the list of objects with the given name unarchived from given element.
 - 
getListpublic java.util.List getList(java.lang.String aName, RXElement anElement, java.util.List defaultList)Returns the list of objects with the given name unarchived from given element (or, if missing, given default).
 - 
getListpublic java.util.List getList(java.lang.String aName, RXElement anElement, java.lang.Class aClass, java.util.List defaultList)Returns the list of objects with the given name unarchived from given element instanciated from given class.
 - 
getListpublic java.util.List getList(java.lang.Class aClass, RXElement anElement)Returns the list of objects of the given class unarchived from the given element.
 - 
getParentpublic java.lang.Object getParent() Returns parent object that initiated unarchival for current object (valid inside that object's fromXML method).
 - 
addParentpublic void addParent(java.lang.Object aParent, RXElement anElement)Adds a parent to the parent list.
 - 
replacepublic void replace(java.lang.Object obj1, java.lang.Object obj2)Called when a fromXML method swaps another object in to replace the one unarchiving.
 - 
getReferencepublic int getReference(java.lang.Object anObj) Returns a reference id for the given object (used in archival).
 - 
getReferencepublic int getReference(java.lang.Object anObj, boolean add)Returns a reference id for given object if in references list with option to add if absent (used in archival).
 - 
getReferencepublic java.lang.Object getReference(java.lang.String aName, RXElement anElement)Returns an object for a given reference (used in unarchival).
 - 
getResourcespublic java.util.List getResources() Returns the list of optional resources associated with this archiver.
 - 
getResourcepublic RXArchiver.Resource getResource(int anIndex) Returns an individual resource associated with this archiver, by index.
 - 
getResourcepublic byte[] getResource(java.lang.String aName) Returns an individual resource associated with this archiver, by name.
 - 
addResourcepublic java.lang.String addResource(byte[] bytes, java.lang.String aName)Adds a byte array resource to this archiver (only if absent).
 
- 
 
-