|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
AbstractBasicConverter.java | - | 100% | 100% | 100% |
|
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 | 86 |
protected String toString(Object obj) {
|
16 | 86 |
return obj.toString();
|
17 |
} |
|
18 |
|
|
19 | 87 |
public void toXML(ObjectTree objectGraph, XMLWriter xmlWriter, ConverterLookup converterLookup) { |
20 | 87 |
xmlWriter.writeText(toString(objectGraph.get())); |
21 |
} |
|
22 |
|
|
23 | 72 |
public void fromXML(ObjectTree objectGraph, XMLReader xmlReader, ConverterLookup converterLookup, Class requiredType) { |
24 | 72 |
objectGraph.set(fromString(xmlReader.text())); |
25 |
} |
|
26 |
|
|
27 |
} |
|
28 |
|
|