/** @inheritdoc */ @Override public Long getKey(Address entity) { if (entity != null) { return entity.getId(); } else { return null; } }
/** @inheritdoc */ @Override public void readEntity(Cursor cursor, Address entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setUsername(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setMobileNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setArea(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setStreet(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setDetail(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setIsDefault(cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0); }
/** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Address entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String username = entity.getUsername(); if (username != null) { stmt.bindString(2, username); } String mobileNo = entity.getMobileNo(); if (mobileNo != null) { stmt.bindString(3, mobileNo); } String area = entity.getArea(); if (area != null) { stmt.bindString(4, area); } String street = entity.getStreet(); if (street != null) { stmt.bindString(5, street); } String detail = entity.getDetail(); if (detail != null) { stmt.bindString(6, detail); } Boolean isDefault = entity.getIsDefault(); if (isDefault != null) { stmt.bindLong(7, isDefault ? 1l : 0l); } }
/** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Address entity, long rowId) { entity.setId(rowId); return rowId; }