|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crsh.cmdline.completers.AbstractPathCompleter<P>
public abstract class AbstractPathCompleter<P>
Constructor Summary | |
---|---|
AbstractPathCompleter()
|
Method Summary | |
---|---|
ValueCompletion |
complete(ParameterDescriptor<?> parameter,
String prefix)
Query the completer for a set of completion for the given prefix. |
protected abstract boolean |
exists(P path)
|
protected abstract Collection<P> |
getChilren(P path)
|
protected abstract String |
getCurrentPath()
|
protected abstract String |
getName(P path)
|
protected abstract P |
getPath(String path)
|
protected abstract boolean |
isDirectory(P path)
|
protected abstract boolean |
isFile(P path)
|
private ValueCompletion |
listDir(P dir,
String filter)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractPathCompleter()
Method Detail |
---|
protected abstract String getCurrentPath() throws Exception
Exception
protected abstract P getPath(String path) throws Exception
Exception
protected abstract boolean exists(P path) throws Exception
Exception
protected abstract boolean isDirectory(P path) throws Exception
Exception
protected abstract boolean isFile(P path) throws Exception
Exception
protected abstract Collection<P> getChilren(P path) throws Exception
Exception
protected abstract String getName(P path) throws Exception
Exception
public final ValueCompletion complete(ParameterDescriptor<?> parameter, String prefix) throws Exception
Completer
Query the completer for a set of completion for the given prefix. The returned ValueCompletion
object
provides the possible suffixes matching the prefix argument. Each entry of the result maps to a possible
completion: an entry key is the possible completion, its corresponding boolean value indicates wether the value can
be further more completed or not.
The prefix value of the completion result is optional and gives a prefix to use more than one result is provided. The interest of the prefix is to limit the size of the completion to display when they can be long, for instance a pat completion returning several values could be display in columns, however only the last name of the path would be displayed and not the entire path.
The following guidelines should be respected:
Example: a completer that would complete colors could
Example: a completer that would complete java packages could
complete
in interface Completer
parameter
- the completed parameterprefix
- the prefix to complete
Exception
- any exception that would prevent completion to perform correctlyprivate ValueCompletion listDir(P dir, String filter) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |