コード例 #1
0
  public static JSONObject toJSONObject(ShoppingCategory model) {
    JSONObject jsonObj = new JSONObject();

    JSONUtil.put(jsonObj, "categoryId", model.getCategoryId());
    JSONUtil.put(jsonObj, "groupId", model.getGroupId());
    JSONUtil.put(jsonObj, "companyId", model.getCompanyId());
    JSONUtil.put(jsonObj, "userId", model.getUserId());
    JSONUtil.put(jsonObj, "userName", model.getUserName());
    JSONUtil.put(jsonObj, "createDate", model.getCreateDate());
    JSONUtil.put(jsonObj, "modifiedDate", model.getModifiedDate());
    JSONUtil.put(jsonObj, "parentCategoryId", model.getParentCategoryId());
    JSONUtil.put(jsonObj, "name", model.getName());
    JSONUtil.put(jsonObj, "description", model.getDescription());

    return jsonObj;
  }
コード例 #2
0
  public int compareTo(ShoppingCategory shoppingCategory) {
    int value = 0;

    if (getParentCategoryId() < shoppingCategory.getParentCategoryId()) {
      value = -1;
    } else if (getParentCategoryId() > shoppingCategory.getParentCategoryId()) {
      value = 1;
    } else {
      value = 0;
    }

    if (value != 0) {
      return value;
    }

    value = getName().toLowerCase().compareTo(shoppingCategory.getName().toLowerCase());

    if (value != 0) {
      return value;
    }

    return 0;
  }