froehlich 01/11/13 04:32:54 Added: apps/db/src/java/org/apache/avalon/db/data/impl DecimalColumn.java Log: Revision Changes Path 1.1 jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DecimalColumn.java Index: DecimalColumn.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. */ package org.apache.avalon.db.data.impl; import org.apache.avalon.db.data.ValidationException; import java.math.BigDecimal; /** * Class DecimalColumn * * @author Gerhard Froehlich <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> * @version $Revision: 1.1 $ */ public class DecimalColumn extends AbstractColumn { /** * Constructor DecimalColumn * @param name */ public DecimalColumn(String name) { super(name,"decimal",BigDecimal.class.getName()); } public void test(Object obj) throws ValidationException { try { BigDecimal bd = new BigDecimal(obj.toString()); } catch (NumberFormatException nfe) { throw new ValidationException("Decimal " + mName + " is not a valid number (" + obj + ")"); } } public Object convertFromString(String str) throws ValidationException { try { return new BigDecimal(str); } catch (NumberFormatException nfe) { throw new ValidationException("Decimal " + mName + " is not a valid number (" + str + ")"); } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>