Record Class CommandArgumentSpecImpl<T,V>

java.lang.Object
java.lang.Record
de.kentoj.kencommandapi.api.argument.CommandArgumentSpecImpl<T,V>
All Implemented Interfaces:
CommandArgumentSpec<T,V>

public record CommandArgumentSpecImpl<T,V>(String id, ArgumentType<T,V> type, List<ArgumentRequirement<V>> requirements, Function<CommandContext<T>, V> defaultValueProvider, @Nullable SuggestionProvider<T> suggestionProvider) extends Record implements CommandArgumentSpec<T,V>
  • Constructor Details

    • CommandArgumentSpecImpl

      public CommandArgumentSpecImpl(String id, ArgumentType<T,V> type, List<ArgumentRequirement<V>> requirements, Function<CommandContext<T>, V> defaultValueProvider, @Nullable @Nullable SuggestionProvider<T> suggestionProvider)
      Creates an instance of a CommandArgumentSpecImpl 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
      defaultValueProvider - the value for the defaultValueProvider record component
      suggestionProvider - the value for the suggestionProvider record component
  • Method Details

    • parseInput

      public V parseInput(String rawInput)
      Specified by:
      parseInput in interface CommandArgumentSpec<T,V>
    • defaultValueProvider

      @Nullable public @Nullable Function<CommandContext<T>, V> defaultValueProvider()
      Returns the value of the defaultValueProvider record component.
      Specified by:
      defaultValueProvider in interface CommandArgumentSpec<T,V>
      Returns:
      the value of the defaultValueProvider record component
    • suggestionProvider

      @NotNull public @NotNull SuggestionProvider<T> suggestionProvider()
      Returns the value of the suggestionProvider record component.
      Specified by:
      suggestionProvider in interface CommandArgumentSpec<T,V>
      Returns:
      the value of the suggestionProvider record component
    • 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.
      Specified by:
      id in interface CommandArgumentSpec<T,V>
      Returns:
      the value of the id record component
    • type

      public ArgumentType<T,V> type()
      Returns the value of the type record component.
      Specified by:
      type in interface CommandArgumentSpec<T,V>
      Returns:
      the value of the type record component
    • requirements

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