Record Class IntPropertyWrapper
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.config.wrapper.IntPropertyWrapper
- Record Components:
property- The live integer configurationProperty, ornullif unconfigured.description- TheConfigDescriptionmetadata 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
ConstructorsConstructorDescriptionIntPropertyWrapper(johnsmith.configoverhauled.api.Property<Integer> property, johnsmith.configoverhauled.api.data.ConfigDescription description) Creates an instance of aIntPropertyWrapperrecord class. -
Method Summary
Modifier and TypeMethodDescriptionjohnsmith.configoverhauled.api.data.ConfigDescriptionReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanDetermines whether a valid integer configuration property is bound to this wrapper.johnsmith.configoverhauled.api.Property<Integer> property()Returns the value of thepropertyrecord component.intresolve(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 StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
IntPropertyWrapper
public IntPropertyWrapper(johnsmith.configoverhauled.api.Property<Integer> property, johnsmith.configoverhauled.api.data.ConfigDescription description) Creates an instance of aIntPropertyWrapperrecord class.- Parameters:
property- the value for thepropertyrecord componentdescription- the value for thedescriptionrecord component
-
-
Method Details
-
isConfigured
public boolean isConfigured()Determines whether a valid integer configuration property is bound to this wrapper.- Returns:
trueifproperty()is non-null,falseotherwise.
-
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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
property
Returns the value of thepropertyrecord component.- Returns:
- the value of the
propertyrecord component
-
description
public johnsmith.configoverhauled.api.data.ConfigDescription description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-