Record Class SettingDescriptor

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.settings.SettingDescriptor
Record Components:
id - the setting's ID in the settings menu
path - its path in settings.yml, such as cornucopia.enabled
type - the kind of value it holds
minimum - the smallest accepted number, for SettingDescriptor.Type.INTEGER and SettingDescriptor.Type.DECIMAL
maximum - the largest accepted number, for SettingDescriptor.Type.INTEGER and SettingDescriptor.Type.DECIMAL
step - the menu's step size, for numbers
allowedValues - the accepted values, for SettingDescriptor.Type.ENUM; empty otherwise

public record SettingDescriptor(@NotNull String id, @NotNull String path, @NotNull SettingDescriptor.Type type, double minimum, double maximum, double step, @NotNull List<String> allowedValues) extends Record
One settings.yml value Zentrix lets administrators edit in its settings menu, and therefore lets addons edit through SettingsService.
Since:
1.8.0
  • Constructor Details

    • SettingDescriptor

      public SettingDescriptor(@NotNull @NotNull String id, @NotNull @NotNull String path, @NotNull @NotNull SettingDescriptor.Type type, double minimum, double maximum, double step, @NotNull @NotNull List<String> allowedValues)
      Creates an instance of a SettingDescriptor record class.
      Parameters:
      id - the value for the id record component
      path - the value for the path record component
      type - the value for the type record component
      minimum - the value for the minimum record component
      maximum - the value for the maximum record component
      step - the value for the step record component
      allowedValues - the value for the allowedValues record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • path

      @NotNull public @NotNull String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • type

      @NotNull public @NotNull SettingDescriptor.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • minimum

      public double minimum()
      Returns the value of the minimum record component.
      Returns:
      the value of the minimum record component
    • maximum

      public double maximum()
      Returns the value of the maximum record component.
      Returns:
      the value of the maximum record component
    • step

      public double step()
      Returns the value of the step record component.
      Returns:
      the value of the step record component
    • allowedValues

      @NotNull public @NotNull List<String> allowedValues()
      Returns the value of the allowedValues record component.
      Returns:
      the value of the allowedValues record component