Get an individual setting value and test it as a boolean.

@param setting the setting to return
@return the value or the default value if no value exists.
16501
public boolean getBooleanSetting( final ChaiSetting setting )
    {
        final String settingValue = getSetting( setting );
        return StringHelper.convertStrToBoolean( settingValue );
    }
444099
public boolean getBoolean(String key, boolean defaultValue) {
    Object value = get(key);
    if (value instanceof Boolean) {
      return (boolean) value;
    } else if (value instanceof String) {
      return Boolean.valueOf((String) value);
    }
    return defaultValue;
  }
561182
public boolean getBoolean(String key, boolean defaultValue) {
		Object o = getObject(key);
		if (o == null) {
			return defaultValue;
		}
		boolean b = defaultValue;
		try {
			b = Boolean.parseBoolean(o.toString());
		}
		catch (Exception e) {
			throw new IllegalArgumentException("Object ["+o+"] associated with key ["+key+"] is not of type Boolean.");
		}
		return b;
	}
1298415
public synchronized boolean getAttribute(String key, boolean defaultValue)
	{
		if(attributes.containsKey(key))
		{
			Object obj = attributes.get(key);
			if(obj instanceof Boolean)
			{
				return (Boolean) obj;
			}
		}
		return defaultValue;
	}
958037
public boolean set(boolean value)
    {
        String prevValue = setString(Boolean.toString(value));
        if (prevValue == null) {
            prevValue = getDefaultValue();
            if (prevValue == null) {
                return false;
            }
        }
        return toBoolean(prevValue);
    }
1039350
public void setSetting(int setting) throws CDKException {
        if (setting < settings.size() + 1 && setting > 0) {
            this.setting = (String) settings.get(setting - 1);
        } else {
            throw new CDKException("Setting " + setting + " does not exist.");
        }
    }
50118
@Override
    public void setSetting(String setting) throws CDKException {
        if (settings.contains(setting)) {
            this.setting = setting;
        } else {
            throw new CDKException("Setting " + setting + " is not allowed.");
        }
    }
549658
public boolean getBooleanConfigAttribute(Map<String, Object> props, String key, boolean defaultValue) {
        if (props.containsKey(key)) {
            return (Boolean) props.get(key);
        }
        return defaultValue;
    }
975166
def get_setting(context, key, default_val="", as_key=None):
    
    if ("%s" % default_val).startswith('$.'):
        default_val = getattr(settings, default_val[2:])
    val = getattr(settings, key, default_val)
    if not as_key:
        return val
    context[as_key] = val
    return ''
1364108
public boolean getBooleanValue(String name, boolean defaultValue) {

        String value = getValue(name);

        if (value == null) {
            return defaultValue;
        } else {
            return value.equals("true");
        }
    }
1092299
public static function get($storage, $setting = null, $defaultValue = false)
    {
        $setting = self::parseSetting($setting);

        if (empty($setting) || empty($storage)) {
            return $defaultValue;
        }

        if (!is_array($storage)) {
            return $defaultValue;
        }

        /**
         * If $setting is an array, process it recursively.
         */
        if (is_array($setting)) {
            /**
             * Check if we have the first $setting element in the
             * configuration data array.
             */
            if (array_key_exists(0, $setting) && array_key_exists($setting[0], $storage)) {
                /**
                 * Remove first element from $setting.
                 */
                $key = array_shift($setting);
                /**
                 * At the end of the recursion $setting will be
                 * an empty array. In this case we simply return the
                 * current configuration data.
                 */
                if (empty($setting)) {
                    return false !== $storage[$key] ? $storage[$key] : $defaultValue;
                }
                /**
                 * Go down one element in the configuration data
                 * and call the method again, with the remainig setting.
                 */
                return self::get($storage[$key], $setting, $defaultValue);
            }
            /**
             * The requested setting doesn't exist in our
             * configuration data array.
             */
            return $defaultValue;
        }

        /**
         * If we arrive here, $setting must be a simple string.
         */
        if (array_key_exists($setting, $storage)) {
            return $storage[$setting];
        }

        /**
         * If we got this far, there is no data to return.
         */
        return $defaultValue;
    }
1346135
public function getSettingValue($name, $default = false)
    {
        $settingValue = $this->manager->getCachedValue($name);

        if ($settingValue) {
            return $settingValue;
        }

        return $default;
    }
473938
@Override
    public void setSetting(String setting) throws CDKException {
        if (setting.equals("true") || setting.equals("false")) {
            this.setting = setting;
        } else if (setting.equals("yes") || setting.equals("y")) {
            this.setting = "true";
        } else if (setting.equals("no") || setting.equals("n")) {
            this.setting = "false";
        } else {
            throw new CDKException("Setting " + setting + " is not a boolean.");
        }
    }
807651
public static boolean getBooleanValue(String appName, String key, boolean defaultValue) {
        String ret = getStringValue0(appName, key);
        return StringUtils.isEmpty(ret) ? defaultValue : CommonUtils.parseBoolean(ret, defaultValue);
    }
624226
@Override
    public void processIOSettingQuestion(IOSetting setting) {
        // post the question
        if (setting.getLevel().ordinal() <= this.level.ordinal()) {
            String answer = setting.getSetting();

            if (setting instanceof BooleanIOSetting) {
                int n = JOptionPane.showConfirmDialog(frame, setting.getQuestion(), setting.getName(),
                        JOptionPane.YES_NO_OPTION);
                if (n == JOptionPane.YES_OPTION) {
                    answer = "true";
                } else if (n == JOptionPane.NO_OPTION) {
                    answer = "false";
                } else {
                    // default of setting
                }
            } else if (setting instanceof OptionIOSetting) {
                OptionIOSetting optionSetting = (OptionIOSetting) setting;
                List<String> settings = optionSetting.getOptions();
                Iterator<String> elements = settings.iterator();
                Object[] options = new Object[settings.size()];
                for (int i = 0; i < options.length; i++) {
                    options[i] = elements.next();
                }
                int n = JOptionPane.showOptionDialog(frame, setting.getQuestion(), setting.getName(),
                        JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, setting.getSetting());
                answer = (String) options[n];
            } else if (setting instanceof StringIOSetting) {
                answer = JOptionPane.showInputDialog(frame, setting.getQuestion(), setting.getName(),
                        JOptionPane.QUESTION_MESSAGE, null, null, setting.getSetting()).toString();
            } else {
                answer = JOptionPane.showInputDialog(frame, setting.getQuestion(), setting.getName(),
                        JOptionPane.QUESTION_MESSAGE, null, null, setting.getSetting()).toString();
            }

            try {
                setting.setSetting(answer);
            } catch (CDKException exception) {
            }
        } // else skip question

    }
64449
public Object getSetting(String name) {
		if (!StringUtils.isBlank(name)) {
			return getSettings().get(name);
		}
		return null;
	}
429322
private Object get(String name) {

		Object value = find(name);
		if (value == null) {
			throw new IllegalArgumentException("Setting: '" + name + "', not found!");
		}

		return value;
	}