コード例 #1
0
ファイル: AbstractModel.java プロジェクト: credil/astrid
  /**
   * Check whether the user has changed this property value and it should be stored for saving in
   * the database
   */
  protected synchronized <TYPE> boolean shouldSaveValue(Property<TYPE> property, TYPE newValue) {

    // we've already decided to save it, so overwrite old value
    if (setValues.containsKey(property.getColumnName())) {
      return true;
    }

    // values contains this key, we should check it out
    if (values != null && values.containsKey(property.getColumnName())) {
      TYPE value = getValue(property);
      if (value == null) {
        if (newValue == null) {
          return false;
        }
      } else if (value.equals(newValue)) {
        return false;
      }
    }

    // otherwise, good to save
    return true;
  }
コード例 #2
0
 public static boolean isType(String type, String format) {
   return TYPE.equals(type) && FORMAT.equals(format);
 }