Record Class IntPropertyWrapper

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.config.wrapper.IntPropertyWrapper
Record Components:
property - The live integer configuration Property, or null if unconfigured.
description - The ConfigDescription metadata identifying the configuration property.

public record IntPropertyWrapper(johnsmith.configoverhauled.api.Property<Integer> property, johnsmith.configoverhauled.api.data.ConfigDescription description) extends Record
Binds an integer configuration Property and its associated ConfigDescription metadata to a primitive integer field on an enchantment definition (such as max_level, weight, or anvil_cost).
  • Constructor Summary

    Constructors
    Constructor
    Description
    IntPropertyWrapper(johnsmith.configoverhauled.api.Property<Integer> property, johnsmith.configoverhauled.api.data.ConfigDescription description)
    Creates an instance of a IntPropertyWrapper record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    johnsmith.configoverhauled.api.data.ConfigDescription
    Returns the value of the description record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Determines whether a valid integer configuration property is bound to this wrapper.
    johnsmith.configoverhauled.api.Property<Integer>
    Returns the value of the property record component.
    int
    resolve(int fallback)
    Resolves the current integer value from the bound configuration property, or returns the provided fallback value if the property is not configured.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IntPropertyWrapper

      public IntPropertyWrapper(johnsmith.configoverhauled.api.Property<Integer> property, johnsmith.configoverhauled.api.data.ConfigDescription description)
      Creates an instance of a IntPropertyWrapper record class.
      Parameters:
      property - the value for the property record component
      description - the value for the description record component
  • Method Details

    • isConfigured

      public boolean isConfigured()
      Determines whether a valid integer configuration property is bound to this wrapper.
      Returns:
      true if property() is non-null, false otherwise.
    • resolve

      public int resolve(int fallback)
      Resolves the current integer value from the bound configuration property, or returns the provided fallback value if the property is not configured.
      Parameters:
      fallback - The default integer value to return if unconfigured.
      Returns:
      The active configured integer value, or fallback.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • property

      public johnsmith.configoverhauled.api.Property<Integer> property()
      Returns the value of the property record component.
      Returns:
      the value of the property record component
    • description

      public johnsmith.configoverhauled.api.data.ConfigDescription description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component