Groovy Documentation

org.codehaus.groovy.tools.shell
[Groovy] Class ReflectionCompletor

java.lang.Object
  org.codehaus.groovy.tools.shell.ReflectionCompletor
All Implemented Interfaces:
jline.Completor

class ReflectionCompletor

Implements the Completor interface to provide competions for GroovyShell by using reflection on global variables.

Authors:
Marty Saxton


Constructor Summary
ReflectionCompletor(Shell shell)

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

int findIdentifierStart(java.lang.String buffer, int endingAt)

Parse a buffer to determine the start index of the groovy identifier

java.util.List findMatchingVariables(java.lang.String prefix)

Build a list of variables defined in the shell that match a given prefix.

java.util.List getPublicFieldsAndMethods(java.lang.Object instance, java.lang.String prefix)

Build a list of public fields and methods for an object that match a given prefix.

 
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()
 

Constructor Detail

ReflectionCompletor

ReflectionCompletor(Shell shell)


 
Method Detail

complete

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


findIdentifierStart

int findIdentifierStart(java.lang.String buffer, int endingAt)
Parse a buffer to determine the start index of the groovy identifier
Parameters:
buffer - the buffer to parse
endingAt - the end index with the buffer
Returns:
the start index of the identifier, or -1 if the buffer does not contain a valid identifier that ends at endingAt


findMatchingVariables

java.util.List findMatchingVariables(java.lang.String prefix)
Build a list of variables defined in the shell that match a given prefix.
Parameters:
prefix - the prefix to match
Returns:
the list of variables that match the prefix


getPublicFieldsAndMethods

java.util.List getPublicFieldsAndMethods(java.lang.Object instance, java.lang.String prefix)
Build a list of public fields and methods for an object that match a given prefix.
Parameters:
instance - the object
prefix - the prefix that must be matched
Returns:
the list of public methods and fields that begin with the prefix


 

Groovy Documentation