01: /*
02: * Copyright (C) 2004 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 07. May 2004 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.converters.basic;
13:
14: import java.math.BigDecimal;
15:
16: /**
17: * Converts a java.math.BigDecimal to a String, retaining
18: * its precision.
19: *
20: * @author Joe Walnes
21: */
22: public class BigDecimalConverter extends AbstractSingleValueConverter {
23:
24: public boolean canConvert(Class type) {
25: return type.equals(BigDecimal.class);
26: }
27:
28: public Object fromString(String str) {
29: return new BigDecimal(str);
30: }
31:
32: }
|