public class RXArchiver
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RXArchiver.Resource
This inner class represents a named resource associated with an archiver.
|
Constructor and Description |
---|
RXArchiver() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addResource(byte[] bytes,
java.lang.String aName)
Adds a byte array resource to this archiver (only if absent).
|
<T> T |
copy(T anObj)
Returns a copy of the given object using archival.
|
protected java.util.Map |
createClassMap()
Creates the class map.
|
<T> T |
fromXML(RXElement anElement,
java.lang.Class<T> aClass,
java.lang.Object anOwner)
Returns an object unarchived from the given element by instantiating the given class.
|
java.lang.Object |
fromXML(RXElement anElement,
java.lang.Object anOwner)
Returns an object unarchived from the given element.
|
java.lang.Object |
fromXML(RXElement anElement,
java.lang.Object anObj,
java.lang.Object anOwner)
Calls fromXML on given object.
|
java.util.List |
fromXMLList(RXElement anElement,
java.lang.String aName,
java.lang.Class aClass,
java.lang.Object anOwner)
Returns the list of objects of the given name and/or class (either can be null) unarchived from the given element.
|
protected java.lang.Class |
getClass(RXElement anElement)
Returns the class for a given element.
|
java.lang.Class |
getClass(java.lang.String aName)
Returns the class for a given element name.
|
java.lang.ClassLoader |
getClassLoader()
Returns the archiver class loader.
|
java.util.Map |
getClassMap()
Returns the class map.
|
java.lang.Object |
getParent()
Returns the top parent from the parent stack.
|
<T> T |
getParent(java.lang.Class<T> aClass)
Returns the first parent from the parent stack of given class.
|
int |
getReference(java.lang.Object anObj)
Returns a reference id for the given object (used in archival).
|
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).
|
java.lang.Object |
getReference(java.lang.String aName,
RXElement anElement)
Returns an object for a given reference (used in unarchival).
|
RXArchiver.Resource |
getResource(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.List<RXArchiver.Resource> |
getResources()
Returns the list of optional resources associated with this archiver.
|
void |
getResources(RXElement anElement)
Reads resources from
|
java.lang.Object |
getRootObject()
Returns the object that the archiver should read "into".
|
RXElement |
getRootXML()
Returns the root xml.
|
WebURL |
getSourceURL()
Returns the WebURL of the currently loading archive.
|
int |
indexOf(RXElement anElement,
java.lang.Class aClass)
Returns the index of the first child element with the given name.
|
int |
indexOf(RXElement anElement,
java.lang.Class aClass,
int startIndex)
Returns the index of the first child element with the given name at or beyond the given index.
|
protected java.lang.Object |
newInstance(java.lang.Class aClass)
Returns a new instance of an object given a class.
|
protected java.lang.Object |
newInstance(RXElement anElement)
Returns a new instance of an object given an element.
|
protected java.lang.Object |
popParent()
Pops a parent from the parent stack.
|
protected void |
pushParent(java.lang.Object anObj)
Pushes a parent on the parent stack.
|
java.lang.Object |
readObject(byte[] theBytes)
Returns a root object unarchived from an RMByteSource.
|
java.lang.Object |
readObject(java.lang.Object aSource)
Returns a root object unarchived from a generic input source (a File, String path, InputStream, URL, byte[], etc.).
|
java.lang.Object |
readObject(RXElement theXML)
Returns a root object unarchived from the XML source (a File, String path, InputStream, URL, byte[], etc.).
|
void |
setClassLoader(java.lang.ClassLoader aClassLoader)
Sets the archiver class loader.
|
void |
setRootObject(java.lang.Object anObj)
Sets the object that the archiver should read "into".
|
RXElement |
toXML(java.lang.Object anObj)
Writes the given object to XML elements.
|
RXElement |
toXML(java.lang.Object anObj,
java.lang.Object anOwner)
Writes the given object to XML elements.
|
RXElement |
writeObject(java.lang.Object anObj)
Returns an xml element for a given object.
|
public WebURL getSourceURL()
public java.lang.Object getRootObject()
public void setRootObject(java.lang.Object anObj)
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader aClassLoader)
public RXElement getRootXML()
public java.util.Map getClassMap()
protected java.util.Map createClassMap()
public java.lang.Object readObject(java.lang.Object aSource)
public java.lang.Object readObject(byte[] theBytes)
public java.lang.Object readObject(RXElement theXML)
public RXElement writeObject(java.lang.Object anObj)
public java.lang.Object fromXML(RXElement anElement, java.lang.Object anOwner)
public <T> T fromXML(RXElement anElement, java.lang.Class<T> aClass, java.lang.Object anOwner)
public java.lang.Object fromXML(RXElement anElement, java.lang.Object anObj, java.lang.Object anOwner)
public RXElement toXML(java.lang.Object anObj)
public RXElement toXML(@Nonnull java.lang.Object anObj, @Nullable java.lang.Object anOwner)
public java.lang.Class getClass(java.lang.String aName)
protected java.lang.Class getClass(RXElement anElement)
protected java.lang.Object newInstance(java.lang.Class aClass)
protected java.lang.Object newInstance(RXElement anElement)
public int getReference(java.lang.Object anObj)
public int getReference(java.lang.Object anObj, boolean add)
public java.lang.Object getReference(java.lang.String aName, RXElement anElement)
public int indexOf(RXElement anElement, java.lang.Class aClass)
public int indexOf(RXElement anElement, java.lang.Class aClass, int startIndex)
public java.util.List fromXMLList(RXElement anElement, java.lang.String aName, java.lang.Class aClass, java.lang.Object anOwner)
public <T> T copy(T anObj)
public java.lang.Object getParent()
public <T> T getParent(java.lang.Class<T> aClass)
protected void pushParent(java.lang.Object anObj)
protected java.lang.Object popParent()
public java.util.List<RXArchiver.Resource> getResources()
public RXArchiver.Resource getResource(int anIndex)
public byte[] getResource(java.lang.String aName)
public java.lang.String addResource(byte[] bytes, java.lang.String aName)
public void getResources(RXElement anElement)