Class RXArchiver
java.lang.Object
com.inductiveautomation.rm.archiver.RXArchiver
- Direct Known Subclasses:
- RMArchiver
This 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.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classThis inner class represents a named resource associated with an archiver.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddResource(byte[] bytes, String aName) Adds a byte array resource to this archiver (only if absent).<T> Tcopy(T anObj) Returns a copy of the given object using archival.protected MapCreates the class map.<T> TReturns an object unarchived from the given element by instantiating the given class.Returns an object unarchived from the given element.Calls fromXML on given object.fromXMLList(RXElement anElement, String aName, Class aClass, Object anOwner) Returns the list of objects of the given name and/or class (either can be null) unarchived from the given element.protected ClassReturns the class for a given element.Returns the class for a given element name.Returns the archiver class loader.Returns the class map.Returns the top parent from the parent stack.<T> TReturns the first parent from the parent stack of given class.intgetReference(Object anObj) Returns a reference id for the given object (used in archival).intgetReference(Object anObj, boolean add) Returns a reference id for given object if in references list with option to add if absent (used in archival).getReference(String aName, RXElement anElement) Returns an object for a given reference (used in unarchival).getResource(int anIndex) Returns an individual resource associated with this archiver, by index.byte[]getResource(String aName) Returns an individual resource associated with this archiver, by name.Returns the list of optional resources associated with this archiver.voidgetResources(RXElement anElement) Reads resources from <resource> elements in given xml (top-level) element, converts from ASCII encoding and adds to archiver.Returns the object that the archiver should read "into".Returns the root xml.Returns the WebURL of the currently loading archive.intReturns the index of the first child element with the given name.intReturns the index of the first child element with the given name at or beyond the given index.protected ObjectnewInstance(RXElement anElement) Returns a new instance of an object given an element.protected ObjectnewInstance(Class aClass) Returns a new instance of an object given a class.protected ObjectPops a parent from the parent stack.protected voidpushParent(Object anObj) Pushes a parent on the parent stack.readObject(byte[] theBytes) Returns a root object unarchived from an RMByteSource.readObject(RXElement theXML) Returns a root object unarchived from the XML source (a File, String path, InputStream, URL, byte[], etc.).readObject(Object aSource) Returns a root object unarchived from a generic input source (a File, String path, InputStream, URL, byte[], etc.).voidsetClassLoader(ClassLoader aClassLoader) Sets the archiver class loader.voidsetRootObject(Object anObj) Sets the object that the archiver should read "into".Writes the given object to XML elements.Writes the given object to XML elements.writeObject(Object anObj) Returns an xml element for a given object.
- 
Constructor Details- 
RXArchiverpublic RXArchiver()
 
- 
- 
Method Details- 
getSourceURLReturns the WebURL of the currently loading archive.
- 
getRootObjectReturns the object that the archiver should read "into".
- 
setRootObjectSets the object that the archiver should read "into".
- 
getClassLoaderReturns the archiver class loader.
- 
setClassLoaderSets the archiver class loader.
- 
getRootXMLReturns the root xml.
- 
getClassMapReturns the class map.
- 
createClassMapCreates the class map.
- 
readObjectReturns a root object unarchived from a generic input source (a File, String path, InputStream, URL, byte[], etc.).
- 
readObjectReturns a root object unarchived from an RMByteSource.
- 
readObjectReturns a root object unarchived from the XML source (a File, String path, InputStream, URL, byte[], etc.). You can also provide a root object to be read "into", and an owner that the object is being read "for".
- 
writeObjectReturns an xml element for a given object. This top level method encodes resources, in addition to doing the basic toXML stuff.
- 
fromXMLReturns an object unarchived from the given element.
- 
fromXMLReturns an object unarchived from the given element by instantiating the given class.
- 
fromXMLCalls fromXML on given object.
- 
toXMLWrites the given object to XML elements.
- 
toXMLWrites the given object to XML elements.
- 
getClassReturns the class for a given element name.
- 
getClassReturns the class for a given element.
- 
newInstanceReturns a new instance of an object given a class.
- 
newInstanceReturns a new instance of an object given an element.
- 
getReferenceReturns a reference id for the given object (used in archival).
- 
getReferenceReturns a reference id for given object if in references list with option to add if absent (used in archival).
- 
getReferenceReturns an object for a given reference (used in unarchival).
- 
indexOfReturns the index of the first child element with the given name.
- 
indexOfReturns the index of the first child element with the given name at or beyond the given index.
- 
fromXMLListReturns the list of objects of the given name and/or class (either can be null) unarchived from the given element.
- 
copypublic <T> T copy(T anObj) Returns a copy of the given object using archival.
- 
getParentReturns the top parent from the parent stack.
- 
getParentReturns the first parent from the parent stack of given class.
- 
pushParentPushes a parent on the parent stack.
- 
popParentPops a parent from the parent stack.
- 
getResourcesReturns the list of optional resources associated with this archiver.
- 
getResourceReturns an individual resource associated with this archiver, by index.
- 
getResourceReturns an individual resource associated with this archiver, by name.
- 
addResourceAdds a byte array resource to this archiver (only if absent).
- 
getResourcesReads resources from <resource> elements in given xml (top-level) element, converts from ASCII encoding and adds to archiver.
 
-