@Override public void readEntity(Cursor cursor, SimpleEntity entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setSimpleBoolean(cursor.isNull(offset + 1) ? null : cursor.getShort(offset + 1) != 0); entity.setSimpleByte(cursor.isNull(offset + 2) ? null : (byte) cursor.getShort(offset + 2)); entity.setSimpleShort(cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3)); entity.setSimpleInt(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4)); entity.setSimpleLong(cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5)); entity.setSimpleFloat(cursor.isNull(offset + 6) ? null : cursor.getFloat(offset + 6)); entity.setSimpleDouble(cursor.isNull(offset + 7) ? null : cursor.getDouble(offset + 7)); entity.setSimpleString(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); entity.setSimpleByteArray(cursor.isNull(offset + 9) ? null : cursor.getBlob(offset + 9)); }
protected void setValuesToNull(SimpleEntity entity) { entity.setSimpleBoolean(null); entity.setSimpleByte(null); entity.setSimpleShort(null); entity.setSimpleInt(null); entity.setSimpleLong(null); entity.setSimpleFloat(null); entity.setSimpleDouble(null); entity.setSimpleString(null); entity.setSimpleByteArray(null); }
protected void setValues(SimpleEntity entity) { entity.setSimpleBoolean(true); entity.setSimpleByte(Byte.MAX_VALUE); entity.setSimpleShort(Short.MAX_VALUE); entity.setSimpleInt(Integer.MAX_VALUE); entity.setSimpleLong(Long.MAX_VALUE); entity.setSimpleFloat(Float.MAX_VALUE); entity.setSimpleDouble(Double.MAX_VALUE); entity.setSimpleString("greenrobot greenDAO"); byte[] bytes = { 42, -17, 23, 0, 127, -128 }; entity.setSimpleByteArray(bytes); }