jline.console.completer
Class ArgumentCompleter.AbstractArgumentDelimiter

java.lang.Object
  extended by jline.console.completer.ArgumentCompleter.AbstractArgumentDelimiter
All Implemented Interfaces:
ArgumentCompleter.ArgumentDelimiter
Direct Known Subclasses:
ArgumentCompleter.WhitespaceArgumentDelimiter
Enclosing class:
ArgumentCompleter

public abstract static class ArgumentCompleter.AbstractArgumentDelimiter
extends java.lang.Object
implements ArgumentCompleter.ArgumentDelimiter

Abstract implementation of a delimiter that uses the isDelimiter(java.lang.CharSequence, int) method to determine if a particular character should be used as a delimiter.

Author:
Marc Prud'hommeaux

Constructor Summary
ArgumentCompleter.AbstractArgumentDelimiter()
           
 
Method Summary
 ArgumentCompleter.ArgumentList delimit(java.lang.CharSequence buffer, int cursor)
          Break the specified buffer into individual tokens that can be completed on their own.
 char[] getEscapeChars()
           
 char[] getQuoteChars()
           
 boolean isDelimiter(java.lang.CharSequence buffer, int pos)
          Returns true if the specified character is a whitespace parameter.
abstract  boolean isDelimiterChar(java.lang.CharSequence buffer, int pos)
          Returns true if the character at the specified position if a delimiter.
 boolean isEscaped(java.lang.CharSequence buffer, int pos)
           
 boolean isQuoted(java.lang.CharSequence buffer, int pos)
           
 void setEscapeChars(char[] chars)
           
 void setQuoteChars(char[] chars)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgumentCompleter.AbstractArgumentDelimiter

public ArgumentCompleter.AbstractArgumentDelimiter()
Method Detail

setQuoteChars

public void setQuoteChars(char[] chars)

getQuoteChars

public char[] getQuoteChars()

setEscapeChars

public void setEscapeChars(char[] chars)

getEscapeChars

public char[] getEscapeChars()

delimit

public ArgumentCompleter.ArgumentList delimit(java.lang.CharSequence buffer,
                                              int cursor)
Description copied from interface: ArgumentCompleter.ArgumentDelimiter
Break the specified buffer into individual tokens that can be completed on their own.

Specified by:
delimit in interface ArgumentCompleter.ArgumentDelimiter
Parameters:
buffer - The buffer to split
cursor - The current position of the cursor in the buffer
Returns:
The tokens

isDelimiter

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

Specified by:
isDelimiter in interface ArgumentCompleter.ArgumentDelimiter
Parameters:
buffer - The complete command buffer
pos - The index of the character in the buffer
Returns:
True if the character should be a delimiter

isQuoted

public boolean isQuoted(java.lang.CharSequence buffer,
                        int pos)

isEscaped

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

isDelimiterChar

public abstract boolean isDelimiterChar(java.lang.CharSequence buffer,
                                        int pos)
Returns true if the character at the specified position if a delimiter. This method will only be called if the character is not enclosed in any of the getQuoteChars(), and is not escaped by ant of the getEscapeChars(). To perform escaping manually, override isDelimiter(java.lang.CharSequence, int) instead.



Copyright © 2008-2011 Sonatype. All Rights Reserved.