public class SimpleCompletor extends Object implements Completor, Cloneable
A simple Completor
implementation that handles a pre-defined
list of completion words.
Example usage:
myConsoleReader.addCompletor (new SimpleCompletor (new String [] { "now", "yesterday", "tomorrow" }));
Modifier and Type | Class and Description |
---|---|
static class |
SimpleCompletor.NoOpFilter |
static interface |
SimpleCompletor.SimpleCompletorFilter
Filter for elements in the completor.
|
Constructor and Description |
---|
SimpleCompletor(InputStream in)
Complete candidates using the whitespearated values in
read from the specified Reader.
|
SimpleCompletor(Reader reader)
Complete candidates using the contents of the specified Reader.
|
SimpleCompletor(String candidateString)
Create a new SimpleCompletor with a single possible completion
values.
|
SimpleCompletor(String[] candidateStrings)
Create a new SimpleCompletor with a list of possible completion
values.
|
SimpleCompletor(String[] strings,
SimpleCompletor.SimpleCompletorFilter filter) |
Modifier and Type | Method and Description |
---|---|
void |
addCandidateString(String candidateString) |
Object |
clone() |
int |
complete(String buffer,
int cursor,
List<String> clist)
Populates candidates with a list of possible completions for the
buffer.
|
SortedSet<String> |
getCandidates() |
String |
getDelimiter() |
void |
setCandidates(SortedSet<String> candidates) |
void |
setCandidateStrings(String[] strings) |
void |
setDelimiter(String delimiter) |
public SimpleCompletor(String candidateString)
public SimpleCompletor(String[] candidateStrings)
public SimpleCompletor(String[] strings, SimpleCompletor.SimpleCompletorFilter filter)
public SimpleCompletor(Reader reader) throws IOException
IOException
public SimpleCompletor(InputStream in) throws IOException
IOException
public int complete(String buffer, int cursor, List<String> clist)
Completor
List
before returning.public void setDelimiter(String delimiter)
public String getDelimiter()
public void setCandidateStrings(String[] strings)
public void addCandidateString(String candidateString)
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright © 2024. All rights reserved.