java.lang.Object
org.teleight.teleightbots.commands.builder.argument.Argument<T>
Type Parameters:
T - the type of the argument
Direct Known Subclasses:
ArgumentInteger, ArgumentString

public abstract class Argument<T> extends Object
Abstract class representing a command argument.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
    The identifier of the argument.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an Argument with the specified identifier.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    Returns the identifier of the argument.
    int
     
    abstract T
    parse(String input)
    Parses the input into an object of type T.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • id

      protected final String id
      The identifier of the argument.
  • Constructor Details

    • Argument

      public Argument(String id)
      Constructs an Argument with the specified identifier.
      Parameters:
      id - the identifier of the argument
  • Method Details

    • getId

      public String getId()
      Returns the identifier of the argument.
      Returns:
      the identifier of the argument
    • parse

      public abstract T parse(String input) throws ArgumentSyntaxException
      Parses the input into an object of type T.
      Parameters:
      input - the input to be parsed
      Returns:
      the parsed object
      Throws:
      ArgumentSyntaxException - if the input cannot be parsed
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      o - the reference object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object