01: /*
02: * Copyright (C) 2006, 2007 XStream Committers.
03: * All rights reserved.
04: *
05: * The software in this package is published under the terms of the BSD
06: * style license a copy of which has been included with this distribution in
07: * the LICENSE.txt file.
08: *
09: * Created on 15. February 2006 by Mauro Talevi
10: */
11: package com.thoughtworks.xstream.converters.basic;
12:
13: import com.thoughtworks.xstream.converters.SingleValueConverter;
14:
15: /**
16: * Base abstract implementation of {@link com.thoughtworks.xstream.converters.SingleValueConverter}.
17: * <p/>
18: * <p>Subclasses should implement methods canConvert(Class) and fromString(String) for the conversion.</p>
19: *
20: * @author Joe Walnes
21: * @author Jörg Schaible
22: * @author Mauro Talevi
23: * @see com.thoughtworks.xstream.converters.SingleValueConverter
24: */
25: public abstract class AbstractSingleValueConverter implements
26: SingleValueConverter {
27:
28: public abstract boolean canConvert(Class type);
29:
30: public String toString(Object obj) {
31: return obj == null ? null : obj.toString();
32: }
33:
34: public abstract Object fromString(String str);
35:
36: }
|