Package org.cloudburstmc.server.utils
Class ConfigSection
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,Object>
Created by fromgate on 26.04.2016.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionEmpty ConfigSection constructorConfigSection(String key, Object value)Constructor of ConfigSection that contains initial key/value dataConfigSection(LinkedHashMap<String,Object> map)Constructor of ConfigSection, based on values stored in map. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck existence of config section elementbooleanCheck existence of config section elementGet object by key.<T> TGet object by key.getAll()Get new instance of config sectionGet root section as LinkedHashMapbooleangetBoolean(String key)Get boolean value of config section elementbooleangetBoolean(String key, boolean defaultValue)Get boolean value of config section elementgetBooleanList(String key)Get Boolean List value of config section elementgetByteList(String key)Get Byte List value of config section elementgetCharacterList(String key)Get Character List value of config section elementdoubleGet double value of config section elementdoubleGet double value of config section elementgetDoubleList(String key)Get Double List value of config section elementgetFloatList(String key)Get Float List value of config section elementintGet int value of config section elementintGet int value of config section elementgetIntegerList(String key)Get Integer List value of config section elementgetKeys()Get all keysgetKeys(boolean child)Get all keys<T> List<T>Get List value of config section element<T> List<T>Get List value of config section elementlongGet long value of config section elementlongGet long value of config section elementgetLongList(String key)Get Long List value of config section elementgetMapList(String key)Get Map List value of config section elementgetSection(String key)Get config section element defined by keyGet all ConfigSections in root path.getSections(String key)Get sections (and only sections) from provided pathgetShortList(String key)Get Short List value of config section elementGet String value of config section elementGet String value of config section elementgetStringList(String key)Get String List value of config section elementbooleanCheck type of section element defined by key.booleanCheck type of section element defined by key.booleanCheck type of section element defined by key.booleanCheck type of section element defined by key.booleanCheck type of section element defined by key.booleanCheck type of section element defined by key.booleanCheck type of section element defined by key.voidRemove config section elementvoidStore value into config sectionMethods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Constructor Details
-
ConfigSection
public ConfigSection()Empty ConfigSection constructor -
ConfigSection
Constructor of ConfigSection that contains initial key/value data- Parameters:
key-value-
-
ConfigSection
Constructor of ConfigSection, based on values stored in map.- Parameters:
map-
-
-
Method Details
-
getAllMap
Get root section as LinkedHashMap- Returns:
-
getAll
Get new instance of config section- Returns:
-
get
Get object by key. If section does not contain value, return null -
get
Get object by key. If section does not contain value, return default value- Parameters:
key-defaultValue-- Returns:
-
set
Store value into config section- Parameters:
key-value-
-
isSection
Check type of section element defined by key. Return true this element is ConfigSection- Parameters:
key-- Returns:
-
getSection
Get config section element defined by key- Parameters:
key-- Returns:
-
getSections
Get all ConfigSections in root path. Example config: a1: b1: c1: c2: a2: b2: c3: c4: a3: true a4: "hello" a5: 100getSections() will return new ConfigSection, that contains sections a1 and a2 only.
- Returns:
-
getSections
Get sections (and only sections) from provided path- Parameters:
key- - config section path, if null or empty root path will used.- Returns:
-
getInt
Get int value of config section element- Parameters:
key- - key (inside) current section (default value equals to 0)- Returns:
-
getInt
Get int value of config section element- Parameters:
key- - key (inside) current sectiondefaultValue- - default value that will returned if section element is not exists- Returns:
-
isInt
Check type of section element defined by key. Return true this element is Integer- Parameters:
key-- Returns:
-
getLong
Get long value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getLong
Get long value of config section element- Parameters:
key- - key (inside) current sectiondefaultValue- - default value that will returned if section element is not exists- Returns:
-
isLong
Check type of section element defined by key. Return true this element is Long- Parameters:
key-- Returns:
-
getDouble
Get double value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getDouble
Get double value of config section element- Parameters:
key- - key (inside) current sectiondefaultValue- - default value that will returned if section element is not exists- Returns:
-
isDouble
Check type of section element defined by key. Return true this element is Double- Parameters:
key-- Returns:
-
getString
Get String value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getString
Get String value of config section element- Parameters:
key- - key (inside) current sectiondefaultValue- - default value that will returned if section element is not exists- Returns:
-
isString
Check type of section element defined by key. Return true this element is String- Parameters:
key-- Returns:
-
getBoolean
Get boolean value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getBoolean
Get boolean value of config section element- Parameters:
key- - key (inside) current sectiondefaultValue- - default value that will returned if section element is not exists- Returns:
-
isBoolean
Check type of section element defined by key. Return true this element is Integer- Parameters:
key-- Returns:
-
getList
Get List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getList
Get List value of config section element- Parameters:
key- - key (inside) current sectiondefaultList- - default value that will returned if section element is not exists- Returns:
-
isList
Check type of section element defined by key. Return true this element is List- Parameters:
key-- Returns:
-
getStringList
Get String List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getIntegerList
Get Integer List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getBooleanList
Get Boolean List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getDoubleList
Get Double List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getFloatList
Get Float List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getLongList
Get Long List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getByteList
Get Byte List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getCharacterList
Get Character List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getShortList
Get Short List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
getMapList
Get Map List value of config section element- Parameters:
key- - key (inside) current section- Returns:
-
exists
Check existence of config section element- Parameters:
key-ignoreCase-- Returns:
-
exists
Check existence of config section element- Parameters:
key-- Returns:
-
remove
Remove config section element- Parameters:
key-
-
getKeys
Get all keys- Parameters:
child- - true = include child keys- Returns:
-
getKeys
Get all keys- Returns:
-