예제 #1
0
  /**
   * Returns a integer from the value, default value if not a integer.
   *
   * @return integer
   */
  public int getInteger(int def) {
    Integer i = MathHelper.castInt(value);
    if (i != null) {
      return i;
    }

    if (value == null) {
      this.setValue(def, true);
    }

    return def;
  }
예제 #2
0
  /**
   * Returns a integer list from the value, default value if not a integer list.
   *
   * @return integer list
   */
  public List<Integer> getIntegerList(List<Integer> def) {
    List<Object> raw = this.getList();
    if (raw != null) {
      List<Integer> list = new ArrayList<Integer>();
      for (Object o : raw) {
        Integer i = MathHelper.castInt(o);
        if (i != null) {
          list.add(i);
        }
      }

      return list;
    }

    return def;
  }