Record Class ConfigFieldList

java.lang.Object
java.lang.Record
org.samo_lego.config2brigadier.common.util.ConfigFieldList

public record ConfigFieldList(Field parentField, Object parent, List<Field> booleans, List<Field> integers, List<Field> floats, List<Field> doubles, List<Field> objects, List<ConfigFieldList> nestedFields) extends Record
Creates an object containing lists with primitives, Objects and nested ConfigFieldLists.
  • Constructor Details

    • ConfigFieldList

      public ConfigFieldList(Field parentField, Object parent, List<Field> booleans, List<Field> integers, List<Field> floats, List<Field> doubles, List<Field> objects, List<ConfigFieldList> nestedFields)
      Creates an instance of a ConfigFieldList record class.
      Parameters:
      parentField - the value for the parentField record component
      parent - the value for the parent record component
      booleans - the value for the booleans record component
      integers - the value for the integers record component
      floats - the value for the floats record component
      doubles - the value for the doubles record component
      objects - the value for the objects record component
      nestedFields - the value for the nestedFields record component
  • Method Details

    • populateFields

      public static ConfigFieldList populateFields(@Nullable @Nullable Field parentField, Object parent, IBrigadierConfigurator config)
      Generates a ConfigFieldList for selected object with recursion. Supports nested values as well.
      Parameters:
      parentField - - field whose name will be used for the command node. If null, it will default to "edit", as the only config object that doesn't have a field is object itself, as it's a class.
      parent - - object to generate ConfigFieldList for
    • 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.
    • parentField

      public Field parentField()
      Returns the value of the parentField record component.
      Returns:
      the value of the parentField record component
    • parent

      public Object parent()
      Returns the value of the parent record component.
      Returns:
      the value of the parent record component
    • booleans

      public List<Field> booleans()
      Returns the value of the booleans record component.
      Returns:
      the value of the booleans record component
    • integers

      public List<Field> integers()
      Returns the value of the integers record component.
      Returns:
      the value of the integers record component
    • floats

      public List<Field> floats()
      Returns the value of the floats record component.
      Returns:
      the value of the floats record component
    • doubles

      public List<Field> doubles()
      Returns the value of the doubles record component.
      Returns:
      the value of the doubles record component
    • objects

      public List<Field> objects()
      Returns the value of the objects record component.
      Returns:
      the value of the objects record component
    • nestedFields

      public List<ConfigFieldList> nestedFields()
      Returns the value of the nestedFields record component.
      Returns:
      the value of the nestedFields record component