Example #1
0
 public static String getColumnDefaultValue(Field field) {
   Column column = field.getAnnotation(Column.class);
   if (column != null && !TextUtils.isEmpty(column.defaultValue())) {
     return column.defaultValue();
   }
   return null;
 }
Example #2
0
  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();
  }