Java SQL Type getReturnClass(String typeName)

Here you can find the source of getReturnClass(String typeName)

Description

get Return Class

License

Apache License

Declaration

final static public Class getReturnClass(String typeName) 

Method Source Code

//package com.java2s;
/**/*from   w  ww. ja  v a2  s  .  co  m*/
 * 
 * Copyright 2008
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 * 
 * @project loonframework
 * @author chenpeng
 * @email?ceponline@yahoo.com.cn
 * @version 0.1
 */

import java.io.InputStream;
import java.lang.reflect.Array;

import java.sql.Blob;
import java.sql.Clob;

import java.util.Calendar;

public class Main {
    final static public Class getReturnClass(String typeName) {
        Class result = null;
        if (typeName.equalsIgnoreCase("long")) {
            result = long.class;
        } else if (typeName.equalsIgnoreCase("int")) {
            result = int.class;
        } else if (typeName.equalsIgnoreCase("integer")) {
            result = Integer.class;
        } else if (typeName.equalsIgnoreCase("short")) {
            result = short.class;
        } else if (typeName.equalsIgnoreCase("float")) {
            result = float.class;
        } else if (typeName.equalsIgnoreCase("double")) {
            result = double.class;
        } else if (typeName.equalsIgnoreCase("boolean")) {
            result = boolean.class;
        } else if (typeName.equalsIgnoreCase("string")) {
            result = String.class;
        } else if (typeName.equalsIgnoreCase("calendar")) {
            result = Calendar.class;
        } else if (typeName.equalsIgnoreCase("inputstream")) {
            result = InputStream.class;
        } else if (typeName.equalsIgnoreCase("blob")) {
            result = Blob.class;
        } else if (typeName.equalsIgnoreCase("clob")) {
            result = Clob.class;
        } else if (typeName.equalsIgnoreCase("char")) {
            result = char.class;
        } else if (typeName.equalsIgnoreCase("character")) {
            result = Character.class;
        } else if (typeName.equalsIgnoreCase("byte")) {
            result = byte.class;
        } else if (typeName.equalsIgnoreCase("object[]")) {
            result = Object[].class;
        } else if (typeName.equalsIgnoreCase("byte[]")) {
            result = byte[].class;
        } else if (typeName.equalsIgnoreCase("array")) {
            result = Array.class;
        } else {
            result = Object.class;
        }
        return result;
    }
}

Related

  1. getParamArray(String signature, int numParam, boolean returnAllParams)
  2. getPartitionSizeValidationError(int colType, String column, String partitionSize)
  3. getPreferredHibernateType(int sqlType, int size, int precision, int scale, boolean nullable, boolean generatedIdentifier)
  4. getPreparedStatementSetMethodMap()
  5. getPrimitiveInstance(Type type, String valueString)
  6. getSemestre(Integer actionformation_id, Connection connection, String actionformation_libellecourt)
  7. getSerialPrimaryKeyTypeString(Connection conn)
  8. getSimpleTypeString(String dbType)
  9. getSQLAttributeType(int sqlType)