KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > converters > basic > BigDecimalConverter


1 package com.thoughtworks.xstream.converters.basic;
2
3 import java.math.BigDecimal JavaDoc;
4
5 /**
6  * Converts a java.math.BigDecimal to a String, retaining
7  * its precision.
8  *
9  * @author Joe Walnes
10  */

11 public class BigDecimalConverter extends AbstractBasicConverter {
12
13     public boolean canConvert(Class JavaDoc type) {
14         return type.equals(BigDecimal JavaDoc.class);
15     }
16
17     protected Object JavaDoc fromString(String JavaDoc str) {
18         return new BigDecimal JavaDoc(str);
19     }
20
21 }
22
Popular Tags