code: public boolean toBoolean(Object val) {
      if (val == null) {
        return false;
      }
      else if (val instanceof Boolean) {
        return ((Boolean) val).booleanValue();
      }
      else if (val instanceof Number) {
        double number = toDouble(val);
        return !Double.isNaN(number) && number != 0.d;
      }
      else if (val instanceof String) {
        String strval = val.toString();
        return strval.length() > 0 && !"false".equals(strval);
      }
      else if (val instanceof Collection<?>) {
        Collection<?> collval = (Collection<?>) val;
        return collval.isEmpty();
      }
      return false;
    }
docs: Coerce to a boolean (not a java.lang.Boolean).
  
  @param val
  Object to be coerced.
  @return The boolean coerced value, or false if none possible.