public class ArgumentCompleter extends java.lang.Object implements Completer
Completer
implementation that invokes a child completer using the appropriate separator argument.
This can be used instead of the individual completers having to know about argument parsing semantics.Modifier and Type | Class and Description |
---|---|
static class |
ArgumentCompleter.AbstractArgumentDelimiter
Abstract implementation of a delimiter that uses the
ArgumentCompleter.AbstractArgumentDelimiter.isDelimiter(java.lang.CharSequence, int) method to determine if a particular
character should be used as a delimiter. |
static interface |
ArgumentCompleter.ArgumentDelimiter
The
ArgumentCompleter.ArgumentDelimiter allows custom breaking up of a String into individual
arguments in order to dispatch the arguments to the nested Completer . |
static class |
ArgumentCompleter.ArgumentList
The result of a delimited buffer.
|
static class |
ArgumentCompleter.WhitespaceArgumentDelimiter
ArgumentCompleter.ArgumentDelimiter implementation that counts all whitespace (as reported by
Character.isWhitespace(char) ) as being a delimiter. |
Constructor and Description |
---|
ArgumentCompleter(ArgumentCompleter.ArgumentDelimiter delimiter,
java.util.Collection<Completer> completers)
Create a new completer with the specified argument delimiter.
|
ArgumentCompleter(ArgumentCompleter.ArgumentDelimiter delimiter,
Completer... completers)
Create a new completer with the specified argument delimiter.
|
ArgumentCompleter(Completer... completers)
Create a new completer with the default
ArgumentCompleter.WhitespaceArgumentDelimiter . |
ArgumentCompleter(java.util.List<Completer> completers)
Create a new completer with the default
ArgumentCompleter.WhitespaceArgumentDelimiter . |
Modifier and Type | Method and Description |
---|---|
int |
complete(java.lang.String buffer,
int cursor,
java.util.List<java.lang.CharSequence> candidates)
Populates candidates with a list of possible completions for the buffer.
|
java.util.List<Completer> |
getCompleters() |
ArgumentCompleter.ArgumentDelimiter |
getDelimiter() |
boolean |
isStrict()
Returns whether a completion at argument index N will success
if all the completions from arguments 0-(N-1) also succeed.
|
void |
setStrict(boolean strict)
If true, a completion at argument index N will only succeed
if all the completions from 0-(N-1) also succeed.
|
public ArgumentCompleter(ArgumentCompleter.ArgumentDelimiter delimiter, java.util.Collection<Completer> completers)
delimiter
- The delimiter for parsing argumentscompleters
- The embedded completerspublic ArgumentCompleter(ArgumentCompleter.ArgumentDelimiter delimiter, Completer... completers)
delimiter
- The delimiter for parsing argumentscompleters
- The embedded completerspublic ArgumentCompleter(Completer... completers)
ArgumentCompleter.WhitespaceArgumentDelimiter
.completers
- The embedded completerspublic ArgumentCompleter(java.util.List<Completer> completers)
ArgumentCompleter.WhitespaceArgumentDelimiter
.completers
- The embedded completerspublic void setStrict(boolean strict)
public boolean isStrict()
public ArgumentCompleter.ArgumentDelimiter getDelimiter()
public java.util.List<Completer> getCompleters()
public int complete(java.lang.String buffer, int cursor, java.util.List<java.lang.CharSequence> candidates)
Completer
List
before returning.Copyright © 2018. All Rights Reserved.