Package snap.props
Class PropArchiver
java.lang.Object
snap.props.PropArchiver
- Direct Known Subclasses:
PropArchiverJS
,PropArchiverXML
This class primarily converts a PropObject (graph) to/from a PropNode (graph).
The graph of PropNodes can easily be converted to/from XML, JSON, etc.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This inner class represents a named resource associated with an archiver. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassMapClass
(Class<? extends PropObject> aClass) Adds a Class to class map.addResource
(String aName, byte[] theBytes) Adds a byte array resource to this archiver (only if absent).protected PropNode
convertNativeToNode
(PropObject aPropObj, Prop aProp) Returns a PropNode for given PropObject.protected Object
convertNativeToNodeForPropRelation
(Prop aProp, Object nativeValue) Converts given native relation object to PropNode/PropNode[].protected void
convertNativeToNodeForProps
(PropObject aPropObj, PropNode aPropNode, Prop[] theProps) Returns a PropNode for given PropObject.protected PropObject
convertNodeToNative
(PropNode propNode, Prop aProp, PropObject aPropObject) Converts a PropNode (graph) to PropObject.<T extends PropObject>
TcopyPropObject
(T aPropObject) Returns a copy of the given PropObject using archival.Creates the map of names to class names.protected PropObject
createPropObjectForClass
(Class<?> aClass) Convenience newInstance.protected PropObject
createPropObjectForPropNode
(PropNode aPropNode, Prop aProp) Creates a PropObject for PropNode.Class<?>
getClassForName
(String aName) Returns a class for name.Returns the map of names to class names.protected Class<?>
getPropObjectClassForPropNode
(PropNode aPropNode, Prop aProp) Returns a PropObject class for PropNode.getResource
(int anIndex) Returns an individual resource associated with this archiver, by index.getResourceForName
(String aName) Returns an individual resource associated with this archiver, by name.Returns the list of optional resources associated with this archiver.Returns the object to read properties into.void
setRootObject
(PropObject rootObject) Sets the object to read properties into.
-
Field Details
-
_helper
-
CLASS_KEY
- See Also:
-
-
Constructor Details
-
PropArchiver
public PropArchiver()Constructor.
-
-
Method Details
-
getRootObject
Returns the object to read properties into. -
setRootObject
Sets the object to read properties into. -
convertNativeToNode
Returns a PropNode for given PropObject. -
convertNativeToNodeForProps
protected void convertNativeToNodeForProps(PropObject aPropObj, PropNode aPropNode, Prop[] theProps) Returns a PropNode for given PropObject. -
convertNativeToNodeForPropRelation
Converts given native relation object to PropNode/PropNode[]. -
convertNodeToNative
Converts a PropNode (graph) to PropObject. -
getClassMap
Returns the map of names to class names. -
createClassMap
Creates the map of names to class names. -
addClassMapClass
Adds a Class to class map. -
getClassForName
Returns a class for name. -
createPropObjectForPropNode
Creates a PropObject for PropNode. -
getPropObjectClassForPropNode
Returns a PropObject class for PropNode. -
createPropObjectForClass
Convenience newInstance. -
copyPropObject
Returns a copy of the given PropObject using archival. -
getResources
Returns the list of optional resources associated with this archiver. -
getResource
Returns an individual resource associated with this archiver, by index. -
getResourceForName
Returns an individual resource associated with this archiver, by name. -
addResource
Adds a byte array resource to this archiver (only if absent).
-