Пример #1
0
  /**
   * Returns a boolean from the value, default value if not a boolean.
   *
   * @return boolean
   */
  public boolean getBoolean(boolean def) {
    Boolean b = MathHelper.castBoolean(value);
    if (b != null) {
      return b;
    }

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

    return def;
  }
Пример #2
0
  /**
   * Returns a boolean list from the value, default value if not a boolean list.
   *
   * @return boolean list
   */
  public List<Boolean> getBooleanList(List<Boolean> def) {
    List<Object> raw = this.getList();
    if (raw != null) {
      List<Boolean> list = new ArrayList<Boolean>();
      for (Object o : raw) {
        Boolean b = MathHelper.castBoolean(o);
        if (b != null) {
          list.add(b);
        }
      }

      return list;
    }

    return def;
  }