Groovy 1.8.4

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

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

class ReflectionCompletor
extends Object

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(String buffer, int cursor, List candidates)

int findIdentifierStart(String buffer, int endingAt)

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

List findMatchingVariables(String prefix)

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

List getPublicFieldsAndMethods(Object instance, String prefix)

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

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

ReflectionCompletor

ReflectionCompletor(Shell shell)


 
Method Detail

complete

int complete(String buffer, int cursor, List candidates)


findIdentifierStart

int findIdentifierStart(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

List findMatchingVariables(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

List getPublicFieldsAndMethods(Object instance, 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


 

Copyright © 2003-2011 The Codehaus. All rights reserved.