Interface YamlObject
- All Superinterfaces:
Comparable<YamlConfiguration>, Iterable<Map.Entry<String, YamlElement>>, YamlConfiguration, YamlElement
Yaml map.
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull YamlArrayasArray()Gets this element as an arraydefault booleanGets this element as a booleandefault doubleasDouble()Gets this element as a doubledefault floatasFloat()Gets this element as a floatdefault intasInt()Gets this element as an intdefault longasLong()Gets this element as alongdefault @NotNull YamlObjectasObject()Gets this element as an objectdefault @NotNull StringasString()Gets this element as a stringget()Gets data as a map.@Nullable YamlElementGets YAML element by some key.default booleangetAsBoolean(@NotNull String path, boolean defaultValue) Gets some value by some key as a booleandefault doublegetAsDouble(@NotNull String path, double defaultValue) Gets some value by some key as a doubledefault floatgetAsFloat(@NotNull String path, float defaultValue) Gets some value by some key as a floatdefault intGets some value by some key as an intdefault longGets some value by some key as alongdefault @NotNull StringgetAsString(@NotNull String path, @NotNull String defaultValue) Gets some value by some key as a stringvoidmerge(@NotNull YamlObject object) Merges data with another object.voidSaves YAML as a flat file.Methods inherited from interface Iterable
forEach, iterator, spliteratorMethods inherited from interface YamlConfiguration
compareTo, path
-
Method Details
-
get
Gets data as a map.- Specified by:
getin interfaceYamlElement- Returns:
- map
-
get
Gets YAML element by some key.- Parameters:
path- key- Returns:
- element or null if not exists.
-
merge
Merges data with another object.- Parameters:
object- another object
-
save
-
asString
Gets this element as a string- Specified by:
asStringin interfaceYamlElement- Returns:
- string
- Throws:
UnsupportedOperationException- if type is different.
-
asInt
default int asInt()Gets this element as an int- Specified by:
asIntin interfaceYamlElement- Returns:
- int
- Throws:
UnsupportedOperationException- if type is different.
-
asFloat
default float asFloat()Gets this element as a float- Specified by:
asFloatin interfaceYamlElement- Returns:
- float
- Throws:
UnsupportedOperationException- if type is different.
-
asDouble
default double asDouble()Gets this element as a double- Specified by:
asDoublein interfaceYamlElement- Returns:
- double
- Throws:
UnsupportedOperationException- if type is different.
-
asBoolean
default boolean asBoolean()Gets this element as a boolean- Specified by:
asBooleanin interfaceYamlElement- Returns:
- boolean
- Throws:
UnsupportedOperationException- if type is different.
-
asLong
default long asLong()Gets this element as along- Specified by:
asLongin interfaceYamlElement- Returns:
- long
- Throws:
UnsupportedOperationException- if type is different.
-
asArray
Gets this element as an array- Specified by:
asArrayin interfaceYamlElement- Returns:
- array
- Throws:
UnsupportedOperationException- if type is different.
-
asObject
Gets this element as an object- Specified by:
asObjectin interfaceYamlElement- Returns:
- object
- Throws:
UnsupportedOperationException- if type is different.
-
getAsBoolean
Gets some value by some key as a boolean- Parameters:
path- keydefaultValue- default value- Returns:
- searched value or default value if null
- Throws:
UnsupportedOperationException- if type is different.
-
getAsFloat
Gets some value by some key as a float- Parameters:
path- keydefaultValue- default value- Returns:
- searched value or default value if null
- Throws:
UnsupportedOperationException- if type is different.
-
getAsInt
Gets some value by some key as an int- Parameters:
path- keydefaultValue- default value- Returns:
- searched value or default value if null
- Throws:
UnsupportedOperationException- if type is different.
-
getAsDouble
Gets some value by some key as a double- Parameters:
path- keydefaultValue- default value- Returns:
- searched value or default value if null
- Throws:
UnsupportedOperationException- if type is different.
-
getAsLong
Gets some value by some key as along- Parameters:
path- keydefaultValue- default value- Returns:
- searched value or default value if null
- Throws:
UnsupportedOperationException- if type is different.
-
getAsString
@NotNull default @NotNull String getAsString(@NotNull @NotNull String path, @NotNull @NotNull String defaultValue) Gets some value by some key as a string- Parameters:
path- keydefaultValue- default value- Returns:
- searched value or default value if null
- Throws:
UnsupportedOperationException- if type is different.
-