Class CompoundParser<T>
java.lang.Object
net.apartium.cocoabeans.commands.parsers.ArgumentParser<T>
net.apartium.cocoabeans.commands.parsers.CompoundParser<T>
- All Implemented Interfaces:
Comparable<ArgumentParser<?>>,GenericNode
@AvailableSince("0.0.37")
public class CompoundParser<T>
extends ArgumentParser<T>
implements GenericNode
-
Nested Class Summary
Nested classes/interfaces inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser
ArgumentParser.ParseResult<T>, ArgumentParser.TabCompletionResult -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCompoundParser(String keyword, Class<T> clazz, int priority, ArgumentMapper argumentMapper, CommandLexer commandLexer) Deprecated, for removal: This API element is subject to removal in a future version.protectedCompoundParser(String keyword, Class<T> clazz, int priority, EvaluationContext evaluationContext) Constructs a new parser -
Method Summary
Modifier and TypeMethodDescriptionparse(CommandProcessingContext processingContext) Tries to parse next argument in the contexttabCompletion(CommandProcessingContext processingContext) Retrieves available options for tab completion of this argumenttryParse(CommandProcessingContext processingContext) Tries to lazily parse next argument in the contextMethods inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser
compareTo, getArgumentType, getKeyword, getPriority
-
Constructor Details
-
CompoundParser
@Deprecated(since="0.0.38", forRemoval=true) protected CompoundParser(String keyword, Class<T> clazz, int priority, ArgumentMapper argumentMapper, CommandLexer commandLexer) Deprecated, for removal: This API element is subject to removal in a future version.Constructs a new parser- Parameters:
keyword- keyword of the parserclazz- output classpriority- priorityargumentMapper- argument mappercommandLexer- command lexer
-
CompoundParser
@AvailableSince("0.0.38") protected CompoundParser(String keyword, Class<T> clazz, int priority, EvaluationContext evaluationContext) Constructs a new parser- Parameters:
keyword- keyword of the parserclazz- output classpriority- priorityevaluationContext- evaluation context
-
-
Method Details
-
parse
Description copied from class:ArgumentParserTries to parse next argument in the context- Specified by:
parsein classArgumentParser<T>- Parameters:
processingContext- cmd processing context- Returns:
- empty if failed, otherwise result
-
tryParse
Description copied from class:ArgumentParserTries to lazily parse next argument in the context- Specified by:
tryParsein classArgumentParser<T>- Parameters:
processingContext- cmd processing context- Returns:
- new index int if success, empty if not
-
tabCompletion
public Optional<ArgumentParser.TabCompletionResult> tabCompletion(CommandProcessingContext processingContext) Description copied from class:ArgumentParserRetrieves available options for tab completion of this argument- Specified by:
tabCompletionin classArgumentParser<T>- Parameters:
processingContext- cmd processing context- Returns:
- tab completion result if success, otherwise empty option
-