Record Class ParserLiteral.WithSuggestions
java.lang.Object
java.lang.Record
dev.jorel.commandapi.arguments.parser.ParserLiteral.WithSuggestions
- Record Components:
base- TheParserLiteralthat defines the parsing behavior.suggestions- TheSuggestionProviderthat will generate the suggestions.
- All Implemented Interfaces:
Parser<Result.Void>,ParserLiteral
- Enclosing interface:
ParserLiteral
public static record ParserLiteral.WithSuggestions(ParserLiteral base, SuggestionProvider suggestions)
extends Record
implements ParserLiteral
A
ParserLiteral that also places suggestions at the cursor of the StringReader when invoked.-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.jorel.commandapi.arguments.parser.ParserLiteral
ParserLiteral.WithSuggestions -
Constructor Summary
ConstructorsConstructorDescriptionWithSuggestions(ParserLiteral base, SuggestionProvider suggestions) Creates an instance of aWithSuggestionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbase()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.getResult(com.mojang.brigadier.StringReader reader) Parses the given input.final inthashCode()Returns a hash code value for this object.voidread(com.mojang.brigadier.StringReader reader) Reads from the given input and either returns successfully or throws an exception explaining why the input could not be interpreted.Returns the value of thesuggestionsrecord component.suggests(SuggestionProvider suggestions) Adds suggestions to theResultof thisParserLiteral.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.jorel.commandapi.arguments.parser.Parser
listSuggestions, parse
-
Constructor Details
-
WithSuggestions
Creates an instance of aWithSuggestionsrecord class.- Parameters:
base- the value for thebaserecord componentsuggestions- the value for thesuggestionsrecord component
-
-
Method Details
-
read
public void read(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException Description copied from interface:ParserLiteralReads from the given input and either returns successfully or throws an exception explaining why the input could not be interpreted.- Specified by:
readin interfaceParserLiteral- Parameters:
reader- TheStringReaderthat holds the input to parse.- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException- If the input is malformed.
-
getResult
Description copied from interface:ParserParses the given input. The returnedResultmust either have a value or an exception.- Specified by:
getResultin interfaceParser<Result.Void>- Specified by:
getResultin interfaceParserLiteral- Parameters:
reader- TheStringReaderthat holds the input to parse.- Returns:
- A
Resultobject holding information about the parse.
-
suggests
Description copied from interface:ParserLiteralAdds suggestions to theResultof thisParserLiteral. The suggestions will be placed where the cursor of theStringReaderwas when the parser was invoked.- Specified by:
suggestsin interfaceParserLiteral- Parameters:
suggestions- TheSuggestionProviderobject that will generate the suggestions.- Returns:
- A
ParserLiteral.WithSuggestionsobject to continue the building process with.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
base
-
suggestions
Returns the value of thesuggestionsrecord component.- Returns:
- the value of the
suggestionsrecord component
-