Example usage for org.apache.commons.validator.routines IntegerValidator IntegerValidator

List of usage examples for org.apache.commons.validator.routines IntegerValidator IntegerValidator

Introduction

In this page you can find the example usage for org.apache.commons.validator.routines IntegerValidator IntegerValidator.

Prototype

public IntegerValidator() 

Source Link

Document

Construct a strict instance.

Usage

From source file:com.btobits.automator.ant.sql.task.SQLCompareTask.java

private int getColumnType(final SQLCompareTask.VerifyCell inRowPos) throws Exception {
    final IntegerValidator validator = new IntegerValidator();
    if (validator.isValid(inRowPos.getField())) {
        Integer id = validator.validate(inRowPos.getField());
        return resultSet.getMetaData().getColumnType(id);
    } else {//from w  w  w. j  a  v a 2  s .c o  m
        for (int i = 0; i < resultSet.getMetaData().getColumnCount(); i++) {
            final String nameColumn = resultSet.getMetaData().getColumnName(i + 1);
            if (StringUtils.equalsIgnoreCase(nameColumn, inRowPos.getField())) {
                return resultSet.getMetaData().getColumnType(i + 1);
            }
        }
    }
    throw new Exception("Unknown field name [" + inRowPos.getField() + "].");
}