View Javadoc
1 package com.thoughtworks.xstream.converters.basic; 2 3 import com.thoughtworks.xstream.converters.Converter; 4 import com.thoughtworks.xstream.converters.ConverterLookup; 5 import com.thoughtworks.xstream.objecttree.ObjectTree; 6 import com.thoughtworks.xstream.xml.XMLReader; 7 import com.thoughtworks.xstream.xml.XMLWriter; 8 9 public abstract class AbstractBasicConverter implements Converter { 10 11 protected abstract Object fromString(String str); 12 13 public abstract boolean canConvert(Class type); 14 15 protected String toString(Object obj) { 16 return obj.toString(); 17 } 18 19 public void toXML(ObjectTree objectGraph, XMLWriter xmlWriter, ConverterLookup converterLookup) { 20 xmlWriter.writeText(toString(objectGraph.get())); 21 } 22 23 public void fromXML(ObjectTree objectGraph, XMLReader xmlReader, ConverterLookup converterLookup, Class requiredType) { 24 objectGraph.set(fromString(xmlReader.text())); 25 } 26 27 }

This page was automatically generated by Maven