/** * Returns the new value for the modified variable cast as a boolean. * <p> * If the variable has been deleted, this method will return <code>false</code>. * </p> * @return the new value for the modified variable. */ public boolean getBooleanValue() { return ConfigurationSection.getBooleanValue(value); }
/** * Returns the value of the specified variable as a boolean. * @param name fully qualified name of the variable whose value should be retrieved. * @return the variable's value if set, <code>false</code> otherwise. * @see #setVariable(String,boolean) * @see #getVariable(String,boolean) */ public boolean getBooleanVariable(String name) { return ConfigurationSection.getBooleanValue(getVariable(name)); }
/** * Returns the next value in the iterator as a boolean. * @return the next value in the iterator as a boolean. * @throws NoSuchElementException if the iteration has no more elements. */ public boolean nextBooleanValue() { return ConfigurationSection.getBooleanValue(nextValue()); }
/** * Returns the value found at the specified index of the list as a boolean. * @param index index of the value to retrieve. * @return the value found at the specified index of the list as a boolean. */ public boolean booleanValueAt(int index) { return ConfigurationSection.getBooleanValue(valueAt(index)); }
/** * Deletes the specified variable from the configuration. * <p> * If the variable was set, a configuration {@link ConfigurationEvent event} will be passed to * all registered LISTENERS. * </p> * @param name name of the variable to remove. * @return the variable's old value, or <code>false</code> if it wasn't set. */ public boolean removeBooleanVariable(String name) { return ConfigurationSection.getBooleanValue(removeVariable(name)); }
/** * Tests the boolean value helpers. */ @Test public void testBooleans() { assert ConfigurationSection.getBooleanValue("true"); assert ConfigurationSection.getValue(true).equals("true"); assert !ConfigurationSection.getBooleanValue("false"); assert !ConfigurationSection.getBooleanValue("!@#"); assert !ConfigurationSection.getBooleanValue(""); assert ConfigurationSection.getValue(false).equals("false"); assert !ConfigurationSection.getBooleanValue(null); }
/** * Retrieves the value of the specified variable as a boolean. * <p> * If the variable isn't set, this method will set it to <code>defaultValue</code> before * returning it. If this happens, a configuration {@link ConfigurationEvent event} will * be sent to all registered LISTENERS. * </p> * @param name name of the variable to retrieve. * @param defaultValue value to use if <code>name</code> is not set. * @return the specified variable's value. * @see #setVariable(String,boolean) * @see #getBooleanVariable(String) */ public boolean getVariable(String name, boolean defaultValue) { return ConfigurationSection.getBooleanValue(getVariable(name, ConfigurationSection.getValue(defaultValue))); }