Java SQL Type isNumberType(int sqlType)

Here you can find the source of isNumberType(int sqlType)

Description

is Number Type

License

Open Source License

Declaration

public static boolean isNumberType(int sqlType) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 hangum.//from www  . j a  v  a  2  s  . c o m
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     hangum - initial API and implementation
 ******************************************************************************/

import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

public class Main {
    private static Map<String, Integer> mapTypes = new HashMap<String, Integer>();

    public static boolean isNumberType(int sqlType) {
        switch (sqlType) {
        case Types.BIGINT:
        case Types.DECIMAL:
        case Types.DOUBLE:
        case Types.FLOAT:
        case Types.INTEGER:
        case Types.NUMERIC:
        case Types.BIT:
        case Types.SMALLINT:
        case Types.TINYINT:
            return true;
        }

        return false;
    }

    public static boolean isNumberType(String rdbType) {
        return isNumberType(mapTypes.get(rdbType));
    }
}

Related

  1. isJDBCType(final int type)
  2. isLobColumn(int dataType)
  3. isNativeType(final Class type)
  4. isNumberic(int type)
  5. isNumberType(int aSqlType)
  6. isNumeric(int dataType)
  7. isNumeric(int dataType)
  8. isNumeric(int pColumnType)
  9. isNumeric(int sqlType)