/** * Returns true if the given configuration option is set to true (for boolean options only). * * @exception IllegalArgumentException The given option is not boolean. */ public boolean isTrue(ConfigOption option) throws IllegalArgumentException { Object v = getValue(option); if (v instanceof Boolean) { return ((Boolean) v).booleanValue(); } else { throw new IllegalArgumentException( "The config option '" + option.toString() + "' does not has a boolean value."); } }
/** * Sets a configuration option. * * @param option denotes the configuration option to be set * @param value a string representation of the value * @exception IllegalArgumentException The given value cannot be parsed or the given config option * is unknown. */ public void setValue(ConfigOption option, String value) throws IllegalArgumentException { if (option.equals(ENABLE_PREDICATE_LOOKUP)) { current_ENABLE_PREDICATE_LOOKUP = Boolean.valueOf( "true".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value) || "1".equals(value)); } else if (option.equals(RECORD_PROVENANCE)) { current_RECORD_PROVENANCE = Boolean.valueOf( "true".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value) || "1".equals(value)); } else { throw new IllegalArgumentException("Unknown config option (" + option.toString() + ")."); } }