Class BooleanTypeParser<S>

java.lang.Object
dev.ua.theroer.magicutils.commands.parsers.BooleanTypeParser<S>
Type Parameters:
S - sender type
All Implemented Interfaces:
TypeParser<S,Boolean>

public class BooleanTypeParser<S> extends Object implements TypeParser<S,Boolean>
Type parser for Boolean arguments.
  • Constructor Details

    • BooleanTypeParser

      public BooleanTypeParser()
      Default constructor.
  • Method Details

    • canParse

      public boolean canParse(@NotNull @NotNull Class<?> type)
      Description copied from interface: TypeParser
      Checks if this parser can handle the given type.
      Specified by:
      canParse in interface TypeParser<S,Boolean>
      Parameters:
      type - the class type to check
      Returns:
      true if this parser can handle the type
    • parse

      @Nullable public @Nullable Boolean parse(@Nullable @Nullable String value, @NotNull @NotNull Class<Boolean> targetType, @NotNull S sender)
      Description copied from interface: TypeParser
      Parses the given value to the target type.
      Specified by:
      parse in interface TypeParser<S,Boolean>
      Parameters:
      value - the string value to parse
      targetType - the target class type
      sender - the command sender (for context like @sender)
      Returns:
      the parsed object or null if parsing failed
    • getSuggestions

      @NotNull public @NotNull List<String> getSuggestions(@NotNull S sender)
      Description copied from interface: TypeParser
      Gets suggestions for this type.
      Specified by:
      getSuggestions in interface TypeParser<S,Boolean>
      Parameters:
      sender - the command sender for context
      Returns:
      list of all possible suggestions