Record Class Argument<C extends CommandContext<C>, V>

java.lang.Object
java.lang.Record
site.lab0x13.scrow.commands.model.argument.Argument<C,V>
Type Parameters:
C - argument of command context
V - argument of argument value
All Implemented Interfaces:
Node<C>

public record Argument<C extends CommandContext<C>, V>(String id, ArgumentType<C extends CommandContext<C>, V> type, List<ArgumentRequirement<C extends CommandContext<C>, V>> requirements, SuggestionProvider<C extends CommandContext<C>> suggestionProvider, DefaultValueProvider<C extends CommandContext<C>, V> defaultValueProvider) extends Record implements Node<C>
  • Constructor Details

    • Argument

      public Argument(String id, ArgumentType<C,V> type, List<ArgumentRequirement<C,V>> requirements, SuggestionProvider<C> suggestionProvider, DefaultValueProvider<C,V> defaultValueProvider)
      Creates an instance of a Argument record class.
      Parameters:
      id - the value for the id record component
      type - the value for the type record component
      requirements - the value for the requirements record component
      suggestionProvider - the value for the suggestionProvider record component
      defaultValueProvider - the value for the defaultValueProvider record component
  • Method Details

    • builder

      public static <C extends CommandContext<C>, V> ArgumentBuilder<C,V> builder(String id, ArgumentType<C,V> type)
    • parse

      public com.leakyabstractions.result.api.Result<ParsedArgument<C,V>, String> parse(C ctx, String rawInput)
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • type

      public ArgumentType<C,V> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • requirements

      public List<ArgumentRequirement<C,V>> requirements()
      Returns the value of the requirements record component.
      Returns:
      the value of the requirements record component
    • suggestionProvider

      public SuggestionProvider<C> suggestionProvider()
      Returns the value of the suggestionProvider record component.
      Specified by:
      suggestionProvider in interface Node<C extends CommandContext<C>>
      Returns:
      the value of the suggestionProvider record component
    • defaultValueProvider

      public DefaultValueProvider<C,V> defaultValueProvider()
      Returns the value of the defaultValueProvider record component.
      Returns:
      the value of the defaultValueProvider record component