com.lidroid.xutils.db.annotation.Id Java Examples

The following examples show how to use com.lidroid.xutils.db.annotation.Id. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColumnUtils.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
public static String getColumnNameByField(Field field) {
    Column column = field.getAnnotation(Column.class);
    if (column != null && !TextUtils.isEmpty(column.column())) {
        return column.column();
    }

    Id id = field.getAnnotation(Id.class);
    if (id != null && !TextUtils.isEmpty(id.column())) {
        return id.column();
    }

    Foreign foreign = field.getAnnotation(Foreign.class);
    if (foreign != null && !TextUtils.isEmpty(foreign.column())) {
        return foreign.column();
    }

    Finder finder = field.getAnnotation(Finder.class);
    if (finder != null) {
        return field.getName();
    }

    return field.getName();
}
 
Example #2
Source File: TableUtils.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
private static String getPrimaryKeyFieldName(Class<?> entityType) {
    com.lidroid.xutils.db.table.Id id = getId(entityType);
    return id == null ? null : id.getColumnField().getName();
}
 
Example #3
Source File: TableUtils.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
private static String getPrimaryKeyColumnName(Class<?> entityType) {
    com.lidroid.xutils.db.table.Id id = getId(entityType);
    return id == null ? null : id.getColumnName();
}