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 Details

  • Constructor Details

    • AbstractConverter

      public AbstractConverter()
  • Method Details

    • 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 reader
      umContext - 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 name
      obj - the object to write
      writer - the writer used to write
      mContext - 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 name
      value - the value to write
      writer - the writer used to write the value
    • getXmlFile

      public File getXmlFile()
    • setXmlFile

      public void setXmlFile(File xmlFile)