org.apache.karaf.shell.console.completer
Class ArgumentCompleter

java.lang.Object
  extended by org.apache.karaf.shell.console.completer.ArgumentCompleter
All Implemented Interfaces:
Completer

public class ArgumentCompleter
extends java.lang.Object
implements Completer


Nested Class Summary
static class ArgumentCompleter.ArgumentList
          The result of a delimited buffer.
 
Constructor Summary
ArgumentCompleter(org.apache.felix.service.command.CommandSession session, AbstractCommand function, java.lang.String command)
           
 
Method Summary
 int complete(java.lang.String buffer, int cursor, java.util.List<java.lang.String> candidates)
           
 ArgumentCompleter.ArgumentList delimit(java.lang.String buffer, int cursor)
           
 boolean getStrict()
          Returns whether a completion at argument index N will succees if all the completions from arguments 0-(N-1) also succeed.
 boolean isDelimiter(java.lang.String buffer, int pos)
          Returns true if the specified character is a whitespace parameter.
 boolean isDelimiterChar(java.lang.String buffer, int pos)
          The character is a delimiter if it is whitespace, and the preceeding character is not an escape character.
 boolean isEscaped(java.lang.String buffer, int pos)
           
 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.
protected  boolean verifyCompleter(Completer completer, java.lang.String argument)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgumentCompleter

public ArgumentCompleter(org.apache.felix.service.command.CommandSession session,
                         AbstractCommand function,
                         java.lang.String command)
Method Detail

setStrict

public 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.


getStrict

public boolean getStrict()
Returns whether a completion at argument index N will succees if all the completions from arguments 0-(N-1) also succeed.


complete

public int complete(java.lang.String buffer,
                    int cursor,
                    java.util.List<java.lang.String> candidates)
Specified by:
complete in interface Completer

verifyCompleter

protected boolean verifyCompleter(Completer completer,
                                  java.lang.String argument)

delimit

public ArgumentCompleter.ArgumentList delimit(java.lang.String buffer,
                                              int cursor)

isDelimiter

public boolean isDelimiter(java.lang.String buffer,
                           int pos)
Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not escaped and returns true from isDelimiterChar(java.lang.String, int).

Parameters:
buffer - the complete command buffer
pos - the index of the character in the buffer
Returns:
true if the character should be a delimiter

isEscaped

public boolean isEscaped(java.lang.String buffer,
                         int pos)

isDelimiterChar

public boolean isDelimiterChar(java.lang.String buffer,
                               int pos)
The character is a delimiter if it is whitespace, and the preceeding character is not an escape character.



Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.