/** * @param key the desired parameter's key * @param alternate the alternate {@link Boolean} * @return a {@link Boolean} for the specified key or the specified * alternate if no matching parameter is found */ public Boolean getBoolean(String key, Boolean alternate) { Boolean bool = getBoolean(key); return (bool != null) ? bool : alternate; }
/** * Looks for a default auto-alternate value in the given params, * if not, set the default to true. * @param parser configuration values */ protected void configure(ValueParser parser) { Boolean auto = parser.getBoolean(AUTO_ALTERNATE_DEFAULT_KEY, Boolean.TRUE); this.autoAlternateDefault = auto.booleanValue(); }
/** * @param key the desired parameter's key * @param alternate The alternate boolean value * @return boolean value for the specified key or the * alternate boolean is no value is found */ public boolean getBoolean(String key, boolean alternate) { Boolean bool = getBoolean(key); return (bool != null) ? bool.booleanValue() : alternate; }
/** * Looks for deprecated parse depth and catch.exceptions properties, * as well as any 'forceThreadSafe' setting. */ protected void configure(ValueParser parser) { // look for deprecated parse.depth key Integer depth = parser.getInteger(KEY_PARSE_DEPTH); if (depth != null) { setParseDepth(depth); } // look for deprecated catch.exceptions key Boolean catchEm = parser.getBoolean(KEY_CATCH_EXCEPTIONS); if (catchEm != null) { setCatchExceptions(catchEm); } // check if they want thread-safety manually turned off this.forceThreadSafe = parser.getBoolean(KEY_FORCE_THREAD_SAFE, forceThreadSafe); // if we're request-scoped, then there's no point in forcing the issue if (Scope.REQUEST.equals(parser.getString("scope"))) { this.forceThreadSafe = false; } }
protected void configure(ValueParser values) { // retrieve any classnames to be inspected and inspect them // *before* setting the storeDynamicLookups property! String[] classnames = values.getStrings(INCLUDE_KEY); if (classnames != null) { for (String classname : classnames) { // make sure we get results for each classname // since these come from the configuration, it's // an error if they're invalid if (in(classname) == null) { // shame that ClassNotFoundException is checked... throw new RuntimeException("Could not find "+classname+" in the classpath"); } } } // find out whether or not we should store dynamic lookups this.storeDynamicLookups = values.getBoolean(STORE_DYNAMIC_KEY, this.storeDynamicLookups); }
/** * Configure this tool * @param values configuration values */ protected void configure(ValueParser values) { this.showDeprecated = values.getBoolean(SHOW_DEPRECATED_KEY, showDeprecated); String classname = values.getString(INSPECT_KEY); if (classname != null) { setType(toClass(classname)); } }
boolean useClassLogger = params.getBoolean(USE_CLASS_LOGGER_KEY, false); if (!useClassLogger)
/** * If {@link #isConfigLocked} returns {@code true}, then this method * does nothing; otherwise, if {@code false}, this will create a new * {@link ValueParser} from the specified Map of params and call * {@link #configure(ValueParser)} with it. Then this will check * the parameters itself to find out whether or not the configuration * for this tool should be put into safe mode or have its config locked. * The safe mode value should be a boolean under the key * {@link #SAFE_MODE_KEY} and the lock value should be a boolean * under the key {@link #LOCK_CONFIG_KEY}. * @param params configuration values map */ public void configure(Map params) { if (!isConfigLocked()) { ValueParser values = new ValueParser(params); // set up logger initLogger(values); // call configure configure(values); setSafeMode(values.getBoolean(SAFE_MODE_KEY, true)); // check under the new key Boolean lock = values.getBoolean(LOCK_CONFIG_KEY, Boolean.TRUE); setLockConfig(lock.booleanValue()); } }
/** * Does the actual configuration. This is protected, so * subclasses may share the same ValueParser and call configure * at any time, while preventing templates from doing so when * configure(Map) is locked. * @param values configuration values */ @Override protected void configure(ValueParser values) { super.configure(values); String delimiter = values.getString(STRINGS_DELIMITER_FORMAT_KEY); if (delimiter != null) { setStringsDelimiter(delimiter); } Boolean allow = values.getBoolean(ALLOWSUBKEYS_KEY); if(allow != null) { setAllowSubkeys(allow); } Boolean ro = values.getBoolean(READONLY_KEY); if(ro != null) { setReadOnly(ro); } }
/** * Does the actual configuration. This is protected, so * subclasses may share the same ValueParser and call configure * at any time, while preventing templates from doing so when * configure(Map) is locked. * @param values configuration values */ @Override protected void configure(ValueParser values) { super.configure(values); String delimiter = values.getString(STRINGS_DELIMITER_FORMAT_KEY); if (delimiter != null) { setStringsDelimiter(delimiter); } Boolean trim = values.getBoolean(STRINGS_TRIM_KEY); if (trim != null) { setStringsTrim(trim); } }
Boolean xhtml = props.getBoolean(XHTML_MODE_KEY); if (xhtml != null) Boolean addParams = props.getBoolean(APPEND_PARAMS_KEY); if (addParams != null) Boolean forceRelative = props.getBoolean(FORCE_RELATIVE_KEY); if (forceRelative != null)
Boolean truncateAtWord = values.getBoolean(TRUNCATE_AT_WORD_KEY); if (truncateAtWord != null)