Package top.focess.qq.api.util.yaml
Class YamlConfiguration
- java.lang.Object
-
- top.focess.qq.api.util.yaml.YamlConfiguration
-
- All Implemented Interfaces:
Serializable,SectionMap
- Direct Known Subclasses:
YamlConfigurationSection
public class YamlConfiguration extends Object implements SectionMap
This class is used to define a YAML configuration.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description YamlConfiguration(Map<String,Object> values)Initialize the YamlConfiguration with existed key-value pairs or not
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description YamlConfigurationSectioncreateSection(String key)Create the section named key<T> Tget(String key)Get the value of the key-value pairYamlConfigurationSectiongetSection(String key)Get the section named keyMap<String,Object>getValues()Get all the key-value pairsstatic YamlConfigurationload(InputStream inputStream)static YamlConfigurationloadFile(File file)Load the file as a YAML configurationvoidsave(File file)Save the YAML configuration as a filevoidset(String key, Object value)Store the key-value pairStringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface top.focess.qq.api.util.SectionMap
contains, keys, remove
-
-
-
-
Method Detail
-
loadFile
public static YamlConfiguration loadFile(File file)
Load the file as a YAML configuration- Parameters:
file- where to load- Returns:
- YAML configuration
-
load
public static YamlConfiguration load(InputStream inputStream)
-
createSection
public YamlConfigurationSection createSection(String key)
Description copied from interface:SectionMapCreate the section named key- Specified by:
createSectionin interfaceSectionMap- Parameters:
key- the key of the Section- Returns:
- a section named key
-
set
public void set(String key, Object value)
Description copied from interface:SectionMapStore the key-value pair- Specified by:
setin interfaceSectionMap- Parameters:
key- the key of the key-value pairvalue- the value of the key-value pair
-
get
public <T> T get(String key)
Description copied from interface:SectionMapGet the value of the key-value pair- Specified by:
getin interfaceSectionMap- Type Parameters:
T- the desired type- Parameters:
key- the key of the key-value pair- Returns:
- the desired value
-
getValues
public Map<String,Object> getValues()
Description copied from interface:SectionMapGet all the key-value pairs- Specified by:
getValuesin interfaceSectionMap- Returns:
- all the key-value pairs
-
save
public void save(File file)
Save the YAML configuration as a file- Parameters:
file- where to save
-
getSection
public YamlConfigurationSection getSection(String key)
Description copied from interface:SectionMapGet the section named key- Specified by:
getSectionin interfaceSectionMap- Parameters:
key- the key of the Section- Returns:
- the section named key
-
-