01: /* $Id: BigIntegerFormat.java 652 2006-01-19 11:12:50Z hengels $ */
02: package org.conform.format;
03:
04: import java.text.*;
05: import java.math.*;
06:
07: /**
08: * java.sql.Date
09: * @version $Revision: 652 $
10: */
11: public class BigIntegerFormat extends AbstractFormat {
12: public BigIntegerFormat() {
13: message = "validation.unparsableNumber";
14: help = "+/-3456";
15: }
16:
17: public String getPattern() {
18: return "#";
19: }
20:
21: public void setPattern(String pattern) {
22: }
23:
24: public String format(Object value) {
25: return value.toString();
26: }
27:
28: public Object parse(String string) throws ParseException {
29: try {
30: return new BigInteger(string);
31: } catch (NumberFormatException e) {
32: throw new ParseException(string, 0);
33: }
34: }
35: }
|