Class StringTypeParser<S>
java.lang.Object
dev.ua.theroer.magicutils.commands.parsers.StringTypeParser<S>
- Type Parameters:
S- sender type
- All Implemented Interfaces:
TypeParser<S,String>
Type parser for String arguments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this parser can handle the given type.intGets the priority of this parser.getSuggestions(S sender) Gets suggestions for this type.@Nullable StringParses the given value to the target type.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TypeParser
canParseSuggestion, getSuggestions, getSuggestions, getSuggestionsFiltered, isEqual, isSender, parseDetailed, parseSuggestion
-
Constructor Details
-
StringTypeParser
public StringTypeParser()Default constructor.
-
-
Method Details
-
canParse
Description copied from interface:TypeParserChecks if this parser can handle the given type.- Specified by:
canParsein interfaceTypeParser<S,String> - Parameters:
type- the class type to check- Returns:
- true if this parser can handle the type
-
parse
@Nullable public @Nullable String parse(@Nullable @Nullable String value, @NotNull @NotNull Class<String> targetType, @NotNull S sender) Description copied from interface:TypeParserParses the given value to the target type.- Specified by:
parsein interfaceTypeParser<S,String> - Parameters:
value- the string value to parsetargetType- the target class typesender- the command sender (for context like @sender)- Returns:
- the parsed object or null if parsing failed
-
getSuggestions
Description copied from interface:TypeParserGets suggestions for this type.- Specified by:
getSuggestionsin interfaceTypeParser<S,String> - Parameters:
sender- the command sender for context- Returns:
- list of all possible suggestions
-
getPriority
public int getPriority()Description copied from interface:TypeParserGets the priority of this parser. Higher priority parsers are checked first.- Specified by:
getPriorityin interfaceTypeParser<S,String> - Returns:
- the priority value
-