org.crsh.jcr.command
Class JCRCommand
java.lang.Object
groovy.lang.GroovyObjectSupport
org.crsh.command.GroovyCommand
org.crsh.command.CRaSHCommand
org.crsh.jcr.command.JCRCommand
- All Implemented Interfaces:
- groovy.lang.GroovyObject, Completer, ShellCommand
public abstract class JCRCommand
- extends CRaSHCommand
- implements Completer
- Version:
- $Revision$
- Author:
- Julien Viet
Methods inherited from class groovy.lang.GroovyObjectSupport |
getMetaClass, setMetaClass |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JCRCommand
protected JCRCommand()
throws IntrospectionException
- Throws:
IntrospectionException
complete
public Map<String,Boolean> complete(ParameterDescriptor<?> parameter,
String prefix)
throws Exception
- Description copied from interface:
Completer
Query the completer for a set of completion for the given prefix. The returned Map
should provide the possible suffixes matching the prefix argument. Each map entry 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 following guidelines
should be respected:
- An empty map means no completion can be determined, the framework will not do anything.
- A singleton map means the match was entire and the framework will complete it with the sole map entry.
- A map containing string sharing a common prefix instruct the framework to insert this common prefix.
- A list containing strings with no common prefix (other than the empty string) instruct the framework to display
the list of possible completions.
When a match is considered as full (the entry value is set to true), the completion should contain a trailing value
that is usually a white space (but it could be a quote for quoted values).
Example: a completer that would complete colors could
- return the map ["lack ":true,"lue ":true] for the prefix "b".
- return the amp ["e ":true] for the prefix "blu".
- return the map [] for the prefix "z".
Example: a completer that would complete java packages could
- return the map ["ext":true,"ext.spi":false] for the prefix "java.t"
- Specified by:
complete
in interface Completer
- Parameters:
parameter
- the completed parameterprefix
- the prefix to complete
- Returns:
- the possible suffix map
- Throws:
Exception
- any exception that would prevent completion to perform correctly
Copyright © 2011 eXo Platform SAS. All Rights Reserved.