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:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>