Exemple #1
0
  static {
    javaToSqlite.put(TypeName.INT, "INTEGER");
    javaToSqlite.put(TypeName.INT.box(), "INTEGER");
    javaToSqlite.put(TypeName.LONG, "INTEGER");
    javaToSqlite.put(TypeName.LONG.box(), "INTEGER");
    javaToSqlite.put(TypeName.SHORT, "INTEGER");
    javaToSqlite.put(TypeName.SHORT.box(), "INTEGER");
    javaToSqlite.put(TypeName.BYTE, "INTEGER");
    javaToSqlite.put(TypeName.BYTE.box(), "INTEGER");

    javaToSqlite.put(TypeName.FLOAT, "REAL");
    javaToSqlite.put(TypeName.FLOAT.box(), "REAL");
    javaToSqlite.put(TypeName.DOUBLE, "REAL");
    javaToSqlite.put(TypeName.DOUBLE.box(), "REAL");

    javaToSqlite.put(ClassName.get(String.class), "TEXT");
    javaToSqlite.put(TypeName.CHAR, "TEXT");
    javaToSqlite.put(TypeName.CHAR.box(), "TEXT");
    javaToSqlite.put(ArrayTypeName.of(TypeName.BYTE), "BLOB");

    javaToSqlite.put(TypeName.BOOLEAN, "BOOLEAN");
    javaToSqlite.put(TypeName.BOOLEAN.box(), "BOOLEAN");

    javaToSqlite.put(Types.SingleRelation, "INTEGER"); // foreign key

    // TODO: date and time types?
  }
 static {
   JAVA_TO_SQLITE_TYPE = new HashMap<>();
   JAVA_TO_SQLITE_TYPE.put(TypeName.INT.toString(), INTEGER);
   JAVA_TO_SQLITE_TYPE.put(TypeName.LONG.toString(), INTEGER);
   JAVA_TO_SQLITE_TYPE.put(TypeName.FLOAT.toString(), REAL);
   JAVA_TO_SQLITE_TYPE.put(TypeName.DOUBLE.toString(), REAL);
   JAVA_TO_SQLITE_TYPE.put(TypeName.BOOLEAN.toString(), INTEGER);
   JAVA_TO_SQLITE_TYPE.put(ClassName.get(String.class).toString(), TEXT);
   JAVA_TO_SQLITE_TYPE.put(BYTE_ARRAY, BLOB);
 }
 static {
   CURSOR_TO_JAVA_TYPE = new HashMap<>();
   CURSOR_TO_JAVA_TYPE.put(TypeName.INT.toString(), "$T.getInt(cursor, $S)");
   CURSOR_TO_JAVA_TYPE.put(TypeName.LONG.toString(), "$T.getLong(cursor, $S)");
   CURSOR_TO_JAVA_TYPE.put(TypeName.FLOAT.toString(), "$T.getFloat(cursor, $S)");
   CURSOR_TO_JAVA_TYPE.put(TypeName.DOUBLE.toString(), "$T.getDouble(cursor, $S)");
   CURSOR_TO_JAVA_TYPE.put(TypeName.BOOLEAN.toString(), "$T.getBoolean(cursor, $S)");
   CURSOR_TO_JAVA_TYPE.put(ClassName.get(String.class).toString(), "$T.getString(cursor, $S)");
   CURSOR_TO_JAVA_TYPE.put(BYTE_ARRAY, "$T.getBlob(cursor, $S)");
 }
Exemple #4
0
 {
   put(ArrayTypeName.of(TypeName.BYTE), "getBlb");
   put(ArrayTypeName.of(TypeName.BYTE.box()), "getBlob");
   put(TypeName.BYTE, "getByt");
   put(TypeName.BYTE.box(), "getByte");
   put(TypeName.DOUBLE, "getDble");
   put(TypeName.DOUBLE.box(), "getDouble");
   put(TypeName.FLOAT, "getFlt");
   put(TypeName.FLOAT.box(), "getFloat");
   put(TypeName.INT, "getInt");
   put(TypeName.INT.box(), "getInteger");
   put(TypeName.LONG, "getLng");
   put(TypeName.LONG.box(), "getLong");
   put(TypeName.SHORT, "getShrt");
   put(TypeName.SHORT.box(), "getShort");
   put(TypeName.BOOLEAN.box(), "getBoolean");
   put(TypeName.BOOLEAN, "getBool");
   put(ClassName.get(String.class), "getString");
   put(ClassName.get(Blob.class), "getBlb");
 }
Exemple #5
0
 {
   put(ArrayTypeName.of(TypeName.BYTE), "getBlob");
   put(ArrayTypeName.of(TypeName.BYTE.box()), "getBlob");
   put(TypeName.BOOLEAN, "getInt");
   put(TypeName.BYTE, "getInt");
   put(TypeName.BYTE.box(), "getInt");
   put(TypeName.CHAR, "getString");
   put(TypeName.CHAR.box(), "getString");
   put(TypeName.DOUBLE, "getDouble");
   put(TypeName.DOUBLE.box(), "getDouble");
   put(TypeName.FLOAT, "getFloat");
   put(TypeName.FLOAT.box(), "getFloat");
   put(TypeName.INT, "getInt");
   put(TypeName.INT.box(), "getInt");
   put(TypeName.LONG, "getLong");
   put(TypeName.LONG.box(), "getLong");
   put(TypeName.SHORT, "getShort");
   put(TypeName.SHORT.box(), "getShort");
   put(ClassName.get(String.class), "getString");
   put(ClassName.get(Blob.class), "getBlob");
 }
Exemple #6
0
 {
   put(TypeName.BYTE, SQLiteHelper.INTEGER);
   put(TypeName.SHORT, SQLiteHelper.INTEGER);
   put(TypeName.INT, SQLiteHelper.INTEGER);
   put(TypeName.LONG, SQLiteHelper.INTEGER);
   put(TypeName.FLOAT, SQLiteHelper.REAL);
   put(TypeName.DOUBLE, SQLiteHelper.REAL);
   put(TypeName.BOOLEAN, SQLiteHelper.INTEGER);
   put(TypeName.CHAR, SQLiteHelper.TEXT);
   put(ArrayTypeName.of(TypeName.BYTE), SQLiteHelper.BLOB);
   put(TypeName.BYTE.box(), SQLiteHelper.INTEGER);
   put(TypeName.SHORT.box(), SQLiteHelper.INTEGER);
   put(TypeName.INT.box(), SQLiteHelper.INTEGER);
   put(TypeName.LONG.box(), SQLiteHelper.INTEGER);
   put(TypeName.FLOAT.box(), SQLiteHelper.REAL);
   put(TypeName.DOUBLE.box(), SQLiteHelper.REAL);
   put(TypeName.BOOLEAN.box(), SQLiteHelper.INTEGER);
   put(TypeName.CHAR.box(), SQLiteHelper.TEXT);
   put(ClassName.get(String.class), SQLiteHelper.TEXT);
   put(ArrayTypeName.of(TypeName.BYTE.box()), SQLiteHelper.BLOB);
   put(ArrayTypeName.of(TypeName.BYTE), SQLiteHelper.BLOB);
   put(ClassName.get(Blob.class), SQLiteHelper.BLOB);
 }