Java examples for java.lang:String SQL
Convert the provided sqlite primitive data type into a java object type
//package com.java2s; public class Main { public static void main(String[] argv) { String sqliteType = "String"; System.out.println(convertSQLiteTypeToJavaObjectType(sqliteType)); }// w ww .j a v a 2 s . c o m private final static String JAVA_TYPE_STRING = "String"; private final static String JAVA_TYPE_OBJECT_INTEGER = "Integer"; private final static String JAVA_TYPE_OBJECT_LONG = "Long"; private final static String JAVA_TYPE_OBJECT_DOUBLE = "Double"; public final static String SQL_TYPE_VARCHAR = "varchar"; public final static String SQL_TYPE_INTEGER = "integer"; public final static String SQL_TYPE_LONG = "long"; public final static String SQL_TYPE_REAL = "real"; /** * Convert the provided sqlite primitive data type into a java object type * @param sqliteType The sqlite primitive data type to convert into a java object type * @return The java object data type that relates to the provided sqliteType */ public static String convertSQLiteTypeToJavaObjectType(String sqliteType) { String javaType = ""; if (sqliteType.equals(SQL_TYPE_VARCHAR)) { javaType = JAVA_TYPE_STRING; } else if (sqliteType.equals(SQL_TYPE_INTEGER)) { javaType = JAVA_TYPE_OBJECT_INTEGER; } else if (sqliteType.equals(SQL_TYPE_LONG)) { javaType = JAVA_TYPE_OBJECT_LONG; } else if (sqliteType.equals(SQL_TYPE_REAL)) { javaType = JAVA_TYPE_OBJECT_DOUBLE; } else { javaType = JAVA_TYPE_STRING; } return javaType; } }