Package com.fancyinnovations.config
Record Class ConfigField<T>
java.lang.Object
java.lang.Record
com.fancyinnovations.config.ConfigField<T>
- Type Parameters:
T- the type of the field value- Record Components:
path- the path to the field in the configuration file (e.g., "notifications.mute_version")description- a description of the fieldforRemoval- indicates if this field should be removeddefaultValue- the default value of the fieldforceDefault- indicates if the default value should be enforcedtype- the class type of the field value
public record ConfigField<T>(String path, String description, boolean forRemoval, T defaultValue, boolean forceDefault, Class<T> type)
extends Record
Represents a field in a configuration file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedefaultValuerecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theforceDefaultrecord component.booleanReturns the value of theforRemovalrecord component.final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
ConfigField
public ConfigField(String path, String description, boolean forRemoval, T defaultValue, boolean forceDefault, Class<T> type) Creates an instance of aConfigFieldrecord class.- Parameters:
path- the value for thepathrecord componentdescription- the value for thedescriptionrecord componentforRemoval- the value for theforRemovalrecord componentdefaultValue- the value for thedefaultValuerecord componentforceDefault- the value for theforceDefaultrecord componenttype- the value for thetyperecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
forRemoval
public boolean forRemoval()Returns the value of theforRemovalrecord component.- Returns:
- the value of the
forRemovalrecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
forceDefault
public boolean forceDefault()Returns the value of theforceDefaultrecord component.- Returns:
- the value of the
forceDefaultrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-