Class EnumNode<E extends Enum<E>>

java.lang.Object
dev.satyrn.papermc.api.configuration.v1.ConfigurationNode<E>
dev.satyrn.papermc.api.configuration.v1.EnumNode<E>
Direct Known Subclasses:
StorageTypeNode

public abstract class EnumNode<E extends Enum<E>> extends ConfigurationNode<E>
Represents a configuration node with an enum value.
Since:
1.0.0
Author:
Isabel Maskrey
  • Constructor Details

    • EnumNode

      public EnumNode(@NotNull @NotNull ConfigurationNode<?> parent, @NotNull @NotNull String name)
      Creates a new configuration node with an enum value.
      Parameters:
      parent - The parent container.
      name - The node's name.
      Since:
      1.0.0
  • Method Details

    • value

      @NotNull public final E value()
      Returns the enum value of the node.
      Specified by:
      value in class ConfigurationNode<E extends Enum<E>>
      Returns:
      The enum value.
      Since:
      1.0.0
    • parse

      @NotNull protected abstract E parse(@NotNull @NotNull String value) throws IllegalArgumentException
      Parses the enum value.
      Parameters:
      value - The string value from the config file
      Returns:
      The parsed enum value.
      Throws:
      IllegalArgumentException - Thrown when the enum value parses.
      Since:
      1.0.0
    • getDefault

      @NotNull protected abstract E getDefault()
      Gets the default enum value.
      Returns:
      The default enum value.
      Since:
      1.0.0
    • defaultValue

      @NotNull public final E defaultValue()
      Gets the default value of the node.
      Specified by:
      defaultValue in class ConfigurationNode<E extends Enum<E>>
      Returns:
      The default value.
      Since:
      1.3.0