public class SectionSnapshot extends CSection
| Modifier and Type | Field and Description |
|---|---|
protected Set<Line> |
entries |
protected ISection |
parent |
protected String |
path |
| Constructor and Description |
|---|
SectionSnapshot(ISection parent,
String path) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommentsAbove(String path,
boolean belowExistingComments,
String... comments)
Adds the given comments above the Entry at the given path.
|
void |
addCommentsBelow(String path,
boolean belowExistingComments,
String... comments)
Adds the given comments below the Entry at the given path.
|
void |
addEntry(Line line) |
boolean |
contains(String path)
Returns if this section contains a list or single value for the given path.
|
Line |
get(String path)
Gets the line with the given path.
Returns null if no line with the given path exists. |
List<Line> |
getEntries() |
List<Line> |
getEntries(String path) |
Set<String> |
getKeys(boolean deep)
Deprecated.
|
Set<String> |
getKeys(String path,
boolean deep)
Deprecated.
|
String |
getName()
Returns the name of this Section.
|
ISection |
getParent() |
String |
getPath()
Returns the path of this Section, relative to the main config.
|
protected String |
getPathTo(String path) |
ISection |
getSection(String path)
Gets the requested
Section by path.Returns an empty section if it didn't exist. |
boolean |
remove(String path)
Removes a Single value, List or Section from the config.
|
boolean |
remove(String path,
boolean renew)
Removes a Single value, List or Section from the config.
|
boolean |
removeBatch(Iterable<String> paths)
Removes a batch of entries from the config.
|
boolean |
removeBatch(String... paths)
Removes a batch of entries from the config.
|
boolean |
removeEntry(Line line) |
void |
renew()
|
boolean |
saveConfig() |
boolean |
set(String path,
boolean renew,
Object value)
Sets the value of the item at the given path to the given value.
If value is null, the entry is removed.NOTE: Calling this method WILL affect the actual config, but the changes may or may not be reflected in this IConfigSection. (Removals and Insertions will not affect SectionSnapshots, but will affect the config.) |
boolean |
setList(String path,
boolean removeComments,
boolean renew,
Iterable<?> value)
Sets the entry at the specified path to a list with the given value.
If this path defines an already existing list entry, it is changed. If this path defines an already existing single entry, it will be changed into a list. If this path defines a non existant entry, it and required sections are created and inserted at the right position in the config. |
getBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharacterList, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInt, getInt, getIntegerList, getLong, getLong, getLongList, getMixedList, getObject, getObject, getShort, getShort, getShortList, getString, getString, getStringList, getT, getT, getTList, isBoolean, isByte, isChar, isDouble, isFloat, isInt, isLong, isShort, isString, isT, setList, setList, setListpublic SectionSnapshot(ISection parent, String path)
path - IllegalArgumentException - If path is null or ends with a dot.public ISection getParent()
public ISection getSection(String path)
ISectionSection by path.@Deprecated public Set<String> getKeys(boolean deep)
ISectiondeep - - Whether or not to get a deep list, as opposed to a shallow list.public String getPath()
ISectionpublic String getName()
ISectionpublic Line get(String path)
ISectionnull if no line with the given path exists.public boolean contains(String path)
ISectionpath - - The path to check.public boolean remove(String path)
ISectionremove(String, true) for more information.public boolean remove(String path, boolean renew)
ISectionISection.renew().
For removals, this can easily be achieved by calling removeBatch(String...)."", this function will CLEAR the config.path - - The path to remove.renew - - If the configuration should be updated to reflect the changes.public boolean removeBatch(Iterable<String> paths)
ISectionremoveBatch in interface ISectionremoveBatch in class CSectionpaths - - The paths that should be removed from this config.ISection.remove(String)public boolean removeBatch(String... paths)
ISectionremoveBatch in interface ISectionremoveBatch in class CSectionpaths - - The paths that should be removed from this config.ISection.remove(String)public boolean setList(String path, boolean removeComments, boolean renew, Iterable<?> value)
ISectionpath - - The path of the list to set.removeComments - - If the list already exists, should comments in it be removed?renew - - If the map should be renewed (when applicable).value - - The values this list should have.public boolean set(String path, boolean renew, Object value)
ISectionnull, the entry is removed.SectionSnapshots, but will affect the config.)path - - The path of the entry you want to change.renew - - If the config should be updated. Only applies for removals and insertions.public void renew()
ISectionpublic void addEntry(Line line)
public boolean removeEntry(Line line)
public boolean saveConfig()
public void addCommentsAbove(String path, boolean belowExistingComments, String... comments)
ISectionpath - - The path of the entry to add the comments above. If path is empty, comments will be added at the top.belowExistingComments - - Should the given comments be added below existing ones?comments - - The comments to addpublic void addCommentsBelow(String path, boolean belowExistingComments, String... comments)
ISectionpath - - The path of the entry to add the comments below. If path is empty, comments will be added at the top.belowExistingComments - - Should the given comments be added below existing ones?comments - - The comments to add@Deprecated public Set<String> getKeys(String path, boolean deep)
ISectionpath - - The path the key has to start with to be included in the returned set.deep - - Whether or not to get a deep list, as opposed to a shallow list.Copyright © 2014. All rights reserved.