You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by fr...@apache.org on 2001/11/13 13:15:56 UTC

cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl SmallIntColumn.java

froehlich    01/11/13 04:15:56

  Added:       apps/db/src/java/org/apache/avalon/db/data/impl
                        SmallIntColumn.java
  Log:
  
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/SmallIntColumn.java
  
  Index: SmallIntColumn.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;
  
  /**
   * Class SmallIntColumn
   *
   * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
   * @version $Revision: 1.1 $
   */
  public class SmallIntColumn extends AbstractColumn {
  
      /**
       * Constructor SmallIntegerColumn
       * @param name
       */
      public SmallIntColumn(String name) {
          super(name,"smallint",Short.class.getName());
      }
  
      public void test(Object obj) throws ValidationException {
          try {
              int i = Short.parseShort(obj.toString());
          } catch (NumberFormatException nfe) {
              throw new ValidationException("SmallInt " + mName + " is not a valid number (" + obj + ")");
          }
      }
  
      public Object convertFromString(String str) throws ValidationException {
          try {
              return new Short(str);
          } catch (NumberFormatException nfe) {
              throw new ValidationException("SmallInt " + mName + " is not a valid number (" + str + ")");
          }
      }
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>