/** * Returns the new value for the modified variable cast as a {@link ValueList}. * <p> * If the variable has been deleted, this method will return null. * </p> * @param separator string used to tokenise the variable's value. * @return the new value for the modified variable. */ public ValueList getListValue(String separator) { return ConfigurationSection.getListValue(value, separator); } }
/** * Returns the value found at the specified index of the list as a {@link ValueList}. * @param index index of the value to retrieve. * @param separator string used to split the value into tokens. * @return the value found at the specified index of the list as a {@link ValueList}. */ public ValueList listValueAt(int index, String separator) { return ConfigurationSection.getListValue(valueAt(index), separator); }
/** * Returns the value of the specified variable as a {@link ValueList}. * @param name fully qualified name of the variable whose value should be retrieved. * @param separator character used to split the variable's value into a list. * @return the variable's value if set, <code>null</code> otherwise. * @see #setVariable(String,List,String) * @see #getVariable(String,List,String) */ public ValueList getListVariable(String name, String separator) { return ConfigurationSection.getListValue(getVariable(name), separator); }
/** * Returns the next value in the iterator as a {@link ValueList}. * @param separator stirng used to tokenise the next value. * @return the next value in the iterator as a {@link ValueList}. * @throws NoSuchElementException if the iteration has no more elements. */ public ValueList nextListValue(String separator) { return ConfigurationSection.getListValue(nextValue(), separator); } }
/** * 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. * @param separator character used to split the variable's value into a list. * @return the variable's old value, or <code>null</code> if it wasn't set. */ public ValueList removeListVariable(String name, String separator) { return ConfigurationSection.getListValue(removeVariable(name), separator); }
/** * Retrieves the value of the specified variable as a {@link ValueList}. * <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 variable <code>name</code> is not set. * @param separator separator to use for <code>defaultValue</code> if variable <code>name</code> is not set. * @return the specified variable's value. * @see #setVariable(String,List,String) * @see #getListVariable(String,String) */ public ValueList getVariable(String name, List<String> defaultValue, String separator) { return ConfigurationSection.getListValue(getVariable(name, ConfigurationSection.getValue(defaultValue, separator)), separator); }
/** * Tests the list value helpers. */ @Test public void testLists() { ValueList list; list = new ValueList("1,2,3,4", ","); assert ConfigurationSection.getListValue("1,2,3,4", ",").equals(list); assert ConfigurationSection.getValue(list, ",").equals("1,2,3,4"); }