Package repast.simphony.xml
Class AbstractConverter
java.lang.Object
repast.simphony.xml.AbstractConverter
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter,com.thoughtworks.xstream.converters.ConverterMatcher
- Direct Known Subclasses:
ContinuousValueLayerConverter,DefaultContextConverter,GeographyConverter,GridConverter,GridValueLayerConverter,NetworkConverter,QuantityConverter,SpaceConverter
public abstract class AbstractConverter
extends Object
implements com.thoughtworks.xstream.converters.Converter
Abstract helper base class for mplementations of a xstream Converters.
- Author:
- Nick Collier
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringarrayToString(double[] vals) protected StringarrayToString(int[] vals) protected ObjectreadNextObject(Object parent, com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext umContext) Gets the next object in the tree.protected StringreadNextString(com.thoughtworks.xstream.io.HierarchicalStreamReader reader) Reads the next value as a String.voidsetXmlFile(File xmlFile) protected double[]stringToDblArray(String val) protected int[]stringToIntArray(String val) protected voidwriteObject(String nodeName, Object obj, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext mContext) Writes an object to XML.protected voidwriteString(String nodeName, String value, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer) Writes a string to the xml stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.thoughtworks.xstream.converters.Converter
marshal, unmarshalMethods inherited from interface com.thoughtworks.xstream.converters.ConverterMatcher
canConvert
-
Field Details
-
classMap
-
xmlFile
-
-
Constructor Details
-
AbstractConverter
public AbstractConverter()
-
-
Method Details
-
arrayToString
-
stringToDblArray
-
arrayToString
-
stringToIntArray
-
readNextObject
protected Object readNextObject(Object parent, com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext umContext) throws ClassNotFoundException Gets the next object in the tree. The object must have been written using writeObject.- Parameters:
parent- the "parent"reader- the readerumContext- the unmarshalling context- Returns:
- the next Object
- Throws:
ClassNotFoundException- the class of the object is not found.
-
readNextString
Reads the next value as a String.- Parameters:
reader- the reader to use- Returns:
- the read String
-
writeObject
protected void writeObject(String nodeName, Object obj, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext mContext) Writes an object to XML.- Parameters:
nodeName- the node nameobj- the object to writewriter- the writer used to writemContext- the marshalling context.
-
writeString
protected void writeString(String nodeName, String value, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer) Writes a string to the xml stream.- Parameters:
nodeName- the node namevalue- the value to writewriter- the writer used to write the value
-
getXmlFile
-
setXmlFile
-