Package top.focess.qq.api.util
Interface SectionMap
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
JSON,JSONSection,Session,SessionSection,YamlConfiguration,YamlConfigurationSection
public interface SectionMap extends Serializable
This is an util class to define basic access to the data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcompute(String key, java.util.function.BiFunction<? super String,? super Object,?> remappingFunction)compute the value of the key-value pairdefault booleancontains(String key)Indicate there is a key-value pair named keybooleancontainsSection(String key)Indicate there is a section named keySectionMapcreateSection(String key)Create the section named key Note: if the section named key already exists, it will be replaced by a new sectiondefault <T> Tget(String key)Get the value of the key-value pairdefault <T> TgetOrDefault(String key, T defaultValue)Get the value of the key-value pairSectionMapgetSection(String key)Get the section named key Note: if the section named key does not exist, it will be createdMap<String,Object>getValues()Get all the key-value pairsdefault Set<String>keys()Get all the keys in setdefault voidremove(String key)Remove the key-value pair named keydefault voidset(String key, Object value)Store the key-value pair
-
-
-
Method Detail
-
set
default void set(String key, Object value)
Store the key-value pair- Parameters:
key- the key of the key-value pairvalue- the value of the key-value pair
-
get
default <T> T get(String key)
Get the value of the key-value pair- Type Parameters:
T- the value type- Parameters:
key- the key of the key-value pair- Returns:
- the value
- Throws:
ClassCastException- if the value is not the specified type
-
contains
default boolean contains(String key)
Indicate there is a key-value pair named key- Parameters:
key- the key of the key-value pair- Returns:
- true there is a key-value pair named key, false otherwise
-
remove
default void remove(String key)
Remove the key-value pair named key- Parameters:
key- the key of the key-value pair
-
createSection
SectionMap createSection(String key)
Create the section named key Note: if the section named key already exists, it will be replaced by a new section- Parameters:
key- the key of the Section- Returns:
- a section named key
-
getValues
Map<String,Object> getValues()
Get all the key-value pairs- Returns:
- all the key-value pairs
-
getSection
SectionMap getSection(String key)
Get the section named key Note: if the section named key does not exist, it will be created- Parameters:
key- the key of the Section- Returns:
- the section named key
- Throws:
UnsupportedOperationException- if there is no section named key
-
containsSection
boolean containsSection(String key)
Indicate there is a section named key- Parameters:
key- the key of the Section- Returns:
- true there is a section named key, false otherwise
-
getOrDefault
default <T> T getOrDefault(String key, T defaultValue)
Get the value of the key-value pair- Type Parameters:
T- the value type- Parameters:
key- the key of the key-value pairdefaultValue- the default value- Returns:
- the value or defaultValue if there is no value
-
-