Groovy Documentation

grails.build.interactive.completors
[Groovy] Class RegexCompletor

java.lang.Object
  grails.build.interactive.completors.RegexCompletor
All Implemented Interfaces:
jline.console.completer.Completer

class RegexCompletor
extends java.lang.Object

JLine Completor that accepts a string if it matches a given regular expression pattern.

Authors:
Peter Ledbrook
Since:
2.0


Property Summary
java.util.regex.Pattern pattern

 
Constructor Summary
RegexCompletor(java.lang.String pattern)

RegexCompletor(java.util.regex.Pattern pattern)

 
Method Summary
int complete(java.lang.String buffer, int cursor, java.util.List candidates)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

pattern

java.util.regex.Pattern pattern


 
Constructor Detail

RegexCompletor

RegexCompletor(java.lang.String pattern)


RegexCompletor

RegexCompletor(java.util.regex.Pattern pattern)


 
Method Detail

complete

int complete(java.lang.String buffer, int cursor, java.util.List candidates)

Check whether the whole buffer matches the configured pattern. If it does, the buffer is added to the candidates list (which indicates acceptance of the buffer string) and returns 0, i.e. the start of the buffer. This mimics the behaviour of SimpleCompletor.

If the buffer doesn't match the configured pattern, this returns -1 and the candidates list is left empty.


 

Groovy Documentation