Class ParsedFlagArgument<S extends CommandSource>

java.lang.Object
studio.mevera.imperat.context.ParsedArgument<S>
studio.mevera.imperat.context.internal.ParsedFlagArgument<S>

public final class ParsedFlagArgument<S extends CommandSource> extends ParsedArgument<S>
  • Method Details

    • forFlag

      public static <S extends CommandSource> ParsedFlagArgument<S> forFlag(FlagArgument<S> flag, String flagRaw, String flagRawInput, int flagPosition, int inputPosition, Object inputValue)
    • forDefaultFlag

      public static <S extends CommandSource> ParsedFlagArgument<S> forDefaultFlag(FlagArgument<S> flag, String defaultValueRaw, Object defaultParsedValue)
    • forSwitch

      public static <S extends CommandSource> ParsedFlagArgument<S> forSwitch(FlagArgument<S> flag, String flagRaw, int flagPosition)
    • forDefaultSwitch

      public static <S extends CommandSource> ParsedFlagArgument<S> forDefaultSwitch(FlagArgument<S> flag)
    • isDefault

      public boolean isDefault()
      Checks if this flag argument is a default value (i.e. not present in the raw input)
      Returns:
      true if this flag argument is a default value, false otherwise
    • isSwitch

      public boolean isSwitch()
      Checks if this flag argument is a switch (i.e. has no input value)
      Returns:
      true if this flag argument is a switch, false otherwise
    • getArgumentRawInput

      @Nullable public @Nullable String getArgumentRawInput()
      The raw input for this flag argument, e.g. "--flag=value" or "-f value"
      Overrides:
      getArgumentRawInput in class ParsedArgument<S extends CommandSource>
      Returns:
      the raw input for this flag argument, empty/blank if this flag argument is a default value (i.e. not present in the raw input)
    • getFlagRawInput

      @Nullable public @Nullable String getFlagRawInput()
      The raw input for the flag, e.g. "--flag" or "-f"
      Returns:
      the raw input for the flag
    • getFlagPosition

      public int getFlagPosition()
      The position of the flag in the raw-input arguments from ArgumentInput
      Returns:
      the position of the flag in the input
    • getInputPosition

      public int getInputPosition()
      The position of the input value for this flag, or -1 if this flag is a switch
      Overrides:
      getInputPosition in class ParsedArgument<S extends CommandSource>
      Returns:
      the position of the input value for this flag, or -1 if this flag is a switch
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object