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

The following examples show how to use com.lidroid.xutils.db.annotation.Column. 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: ColumnUtils.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
public static String getColumnDefaultValue(Field field) {
    Column column = field.getAnnotation(Column.class);
    if (column != null && !TextUtils.isEmpty(column.defaultValue())) {
        return column.defaultValue();
    }
    return null;
}