app/src/main/java/db/juhaku/juhakudb/core/schema/SchemaFactory.java
/*
     * Resolve type of column for database tables.
     */
Resolve type of column for database tables.
Resolve type of column for database tables .
private static String resolveType(Field field) {
        Class<?> type = field.getType();
        if (type.isAssignableFrom(Integer.class) || type.isAssignableFrom(int.class)
                || type.isAssignableFrom(Short.class) || type.isAssignableFrom(short.class)
                || type.isAssignableFrom(Long.class) || type.isAssignableFrom(long.class)
                || type.isAssignableFrom(Byte.class) || type.isAssignableFrom(byte.class)
                || type.isAssignableFrom(BigInteger.class) || type.isAnnotationPresent(Entity.class)) {
            return "INTEGER";
        } else if (type.isAssignableFrom(Double.class) || type.isAssignableFrom(double.class)
                || type.isAssignableFrom(Float.class) || type.isAssignableFrom(float.class)) {
            return "REAL";
        } else if (type.isAssignableFrom(BigDecimal.class) || type.isAssignableFrom(Boolean.class)
                || type.isAssignableFrom(boolean.class)) {
            return "NUMERIC";
        } else if (type.isAssignableFrom(byte[].class)) {
            return "BLOB";
        }
        return "TEXT";
    }
private static String resolveType ( Field field ) { Class < ? > type = field . getType ( ) ; if ( type . isAssignableFrom ( Integer . class ) || type . isAssignableFrom ( int . class ) || type . isAssignableFrom ( Short . class ) || type . isAssignableFrom ( short . class ) || type . isAssignableFrom ( Long . class ) || type . isAssignableFrom ( long . class ) || type . isAssignableFrom ( Byte . class ) || type . isAssignableFrom ( byte . class ) || type . isAssignableFrom ( BigInteger . class ) || type . isAnnotationPresent ( Entity . class ) ) { return "INTEGER" ; } else if ( type . isAssignableFrom ( Double . class ) || type . isAssignableFrom ( double . class ) || type . isAssignableFrom ( Float . class ) || type . isAssignableFrom ( float . class ) ) { return "REAL" ; } else if ( type . isAssignableFrom ( BigDecimal . class ) || type . isAssignableFrom ( Boolean . class ) || type . isAssignableFrom ( boolean . class ) ) { return "NUMERIC" ; } else if ( type . isAssignableFrom ( byte [ ] . class ) ) { return "BLOB" ; } return "TEXT" ; }
Resolve type of column for database tables.
Resolve type of column for database tables .