Class ParsedFlagArgument<S extends CommandSource>
java.lang.Object
studio.mevera.imperat.context.ParsedArgument<S>
studio.mevera.imperat.context.internal.ParsedFlagArgument<S>
-
Field Summary
Fields inherited from class studio.mevera.imperat.context.ParsedArgument
argumentParsedValue, originalArgument, raw -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <S extends CommandSource>
ParsedFlagArgument<S>forDefaultFlag(FlagArgument<S> flag, String defaultValueRaw, Object defaultParsedValue) static <S extends CommandSource>
ParsedFlagArgument<S>forDefaultSwitch(FlagArgument<S> flag) static <S extends CommandSource>
ParsedFlagArgument<S>forFlag(FlagArgument<S> flag, String flagRaw, String flagRawInput, int flagPosition, int inputPosition, Object inputValue) static <S extends CommandSource>
ParsedFlagArgument<S>forSwitch(FlagArgument<S> flag, String flagRaw, int flagPosition) @Nullable StringThe raw input for this flag argument, e.g.intThe position of the flag in the raw-input arguments fromArgumentInput@Nullable StringThe raw input for the flag, e.g.intThe position of the input value for this flag, or -1 if this flag is a switchinthashCode()booleanChecks if this flag argument is a default value (i.e.booleanisSwitch()Checks if this flag argument is a switch (i.e.Methods inherited from class studio.mevera.imperat.context.ParsedArgument
getArgumentName, getArgumentParsedValue, getOriginalArgument, toString
-
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
The raw input for this flag argument, e.g. "--flag=value" or "-f value"- Overrides:
getArgumentRawInputin classParsedArgument<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
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 fromArgumentInput- 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:
getInputPositionin classParsedArgument<S extends CommandSource>- Returns:
- the position of the input value for this flag, or -1 if this flag is a switch
-
equals
-
hashCode
public int hashCode()
-