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
-
-
Constructor Summary
Constructors Constructor Description AbstractConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
arrayToString(double[] vals)
protected String
arrayToString(int[] vals)
File
getXmlFile()
protected Object
readNextObject(Object parent, com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext umContext)
Gets the next object in the tree.protected String
readNextString(com.thoughtworks.xstream.io.HierarchicalStreamReader reader)
Reads the next value as a String.void
setXmlFile(File xmlFile)
protected double[]
stringToDblArray(String val)
protected int[]
stringToIntArray(String val)
protected void
writeObject(String nodeName, Object obj, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext mContext)
Writes an object to XML.protected void
writeString(String nodeName, String value, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer)
Writes a string to the xml stream.
-
-
-
Method Detail
-
arrayToString
protected String arrayToString(double[] vals)
-
stringToDblArray
protected double[] stringToDblArray(String val)
-
arrayToString
protected String arrayToString(int[] vals)
-
stringToIntArray
protected int[] stringToIntArray(String val)
-
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
protected String readNextString(com.thoughtworks.xstream.io.HierarchicalStreamReader reader)
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
public File getXmlFile()
-
setXmlFile
public void setXmlFile(File xmlFile)
-
-