Interface YamlObject

All Superinterfaces:
Comparable<YamlConfiguration>, Iterable<Map.Entry<String,YamlElement>>, YamlConfiguration, YamlElement

public interface YamlObject extends Iterable<Map.Entry<String,YamlElement>>, YamlElement
Yaml map.
  • Method Summary

    Modifier and Type
    Method
    Description
    default @NotNull YamlArray
    Gets this element as an array
    default boolean
    Gets this element as a boolean
    default double
    Gets this element as a double
    default float
    Gets this element as a float
    default int
    Gets this element as an int
    default long
    Gets this element as along
    default @NotNull YamlObject
    Gets this element as an object
    default @NotNull String
    Gets this element as a string
    @NotNull Map<String,Object>
    get()
    Gets data as a map.
    @Nullable YamlElement
    get(@NotNull String path)
    Gets YAML element by some key.
    default boolean
    getAsBoolean(@NotNull String path, boolean defaultValue)
    Gets some value by some key as a boolean
    default double
    getAsDouble(@NotNull String path, double defaultValue)
    Gets some value by some key as a double
    default float
    getAsFloat(@NotNull String path, float defaultValue)
    Gets some value by some key as a float
    default int
    getAsInt(@NotNull String path, int defaultValue)
    Gets some value by some key as an int
    default long
    getAsLong(@NotNull String path, long defaultValue)
    Gets some value by some key as along
    default @NotNull String
    getAsString(@NotNull String path, @NotNull String defaultValue)
    Gets some value by some key as a string
    void
    merge(@NotNull YamlObject object)
    Merges data with another object.
    void
    save(@NotNull File file)
    Saves YAML as a flat file.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods inherited from interface kr.toxicity.hud.api.yaml.YamlConfiguration

    compareTo, path
  • Method Details

    • get

      @NotNull @NotNull Map<String,Object> get()
      Gets data as a map.
      Specified by:
      get in interface YamlElement
      Returns:
      map
    • get

      @Nullable @Nullable YamlElement get(@NotNull @NotNull String path)
      Gets YAML element by some key.
      Parameters:
      path - key
      Returns:
      element or null if not exists.
    • merge

      void merge(@NotNull @NotNull YamlObject object)
      Merges data with another object.
      Parameters:
      object - another object
    • save

      void save(@NotNull @NotNull File file)
      Saves YAML as a flat file.
      Parameters:
      file - target file
    • asString

      @NotNull default @NotNull String asString()
      Gets this element as a string
      Specified by:
      asString in interface YamlElement
      Returns:
      string
      Throws:
      UnsupportedOperationException - if type is different.
    • asInt

      default int asInt()
      Gets this element as an int
      Specified by:
      asInt in interface YamlElement
      Returns:
      int
      Throws:
      UnsupportedOperationException - if type is different.
    • asFloat

      default float asFloat()
      Gets this element as a float
      Specified by:
      asFloat in interface YamlElement
      Returns:
      float
      Throws:
      UnsupportedOperationException - if type is different.
    • asDouble

      default double asDouble()
      Gets this element as a double
      Specified by:
      asDouble in interface YamlElement
      Returns:
      double
      Throws:
      UnsupportedOperationException - if type is different.
    • asBoolean

      default boolean asBoolean()
      Gets this element as a boolean
      Specified by:
      asBoolean in interface YamlElement
      Returns:
      boolean
      Throws:
      UnsupportedOperationException - if type is different.
    • asLong

      default long asLong()
      Gets this element as along
      Specified by:
      asLong in interface YamlElement
      Returns:
      long
      Throws:
      UnsupportedOperationException - if type is different.
    • asArray

      @NotNull default @NotNull YamlArray asArray()
      Gets this element as an array
      Specified by:
      asArray in interface YamlElement
      Returns:
      array
      Throws:
      UnsupportedOperationException - if type is different.
    • asObject

      @NotNull default @NotNull YamlObject asObject()
      Gets this element as an object
      Specified by:
      asObject in interface YamlElement
      Returns:
      object
      Throws:
      UnsupportedOperationException - if type is different.
    • getAsBoolean

      default boolean getAsBoolean(@NotNull @NotNull String path, boolean defaultValue)
      Gets some value by some key as a boolean
      Parameters:
      path - key
      defaultValue - default value
      Returns:
      searched value or default value if null
      Throws:
      UnsupportedOperationException - if type is different.
    • getAsFloat

      default float getAsFloat(@NotNull @NotNull String path, float defaultValue)
      Gets some value by some key as a float
      Parameters:
      path - key
      defaultValue - default value
      Returns:
      searched value or default value if null
      Throws:
      UnsupportedOperationException - if type is different.
    • getAsInt

      default int getAsInt(@NotNull @NotNull String path, int defaultValue)
      Gets some value by some key as an int
      Parameters:
      path - key
      defaultValue - default value
      Returns:
      searched value or default value if null
      Throws:
      UnsupportedOperationException - if type is different.
    • getAsDouble

      default double getAsDouble(@NotNull @NotNull String path, double defaultValue)
      Gets some value by some key as a double
      Parameters:
      path - key
      defaultValue - default value
      Returns:
      searched value or default value if null
      Throws:
      UnsupportedOperationException - if type is different.
    • getAsLong

      default long getAsLong(@NotNull @NotNull String path, long defaultValue)
      Gets some value by some key as along
      Parameters:
      path - key
      defaultValue - 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 - key
      defaultValue - default value
      Returns:
      searched value or default value if null
      Throws:
      UnsupportedOperationException - if type is different.