@Deprecated class ReflectionCompletor extends Object
Completes fields and methods of Classes or instances. Does not quite respect the contract of IdentifierCompletor, as last Token may be a dot or not, thus also returns as int the cursor position.
Constructor and description |
---|
ReflectionCompletor
(Groovysh shell)
|
Type Params | Return Type | Name and description |
---|---|---|
|
static boolean |
acceptName(String name, String prefix) |
|
int |
complete(List<GroovySourceToken> tokens, List<CharSequence> candidates) |
|
static List<String> |
getDefaultMethods(Object instance, String prefix) Offering all DefaultGroovyMethods on any object is too verbose, hiding all removes user-friendliness. |
|
static CharSequence |
getFieldnameForAccessor(String accessor, int parameterLength) |
|
Object |
getInvokerClassOrInstance(List<GroovySourceToken> groovySourceTokens) Takes the last ? |
|
static List<GroovySourceToken> |
getInvokerTokens(List<GroovySourceToken> groovySourceTokens) return the last tokens of a list that form an expression to be completed after the next dot, or null if expression cannot be detected. |
|
static Collection<String> |
getMetaclassMethods(Object instance, String prefix, boolean includeMetaClassImplMethods) |
|
static Collection<ReflectionCompletionCandidate> |
getPublicFieldsAndMethods(Object instance, String prefix) Build a list of public fields and methods for an object that match a given prefix. |
|
static Object |
removeStandardMethods(Collection<ReflectionCompletionCandidate> candidates) removes candidates that, most of the times, a programmer does not want to see in completion |
|
static String |
tokenListToEvalString(List<GroovySourceToken> groovySourceTokens) |
metaclass_completion_prefix_length
- how long the prefix must be to display candidates from metaclassOffering all DefaultGroovyMethods on any object is too verbose, hiding all removes user-friendliness. So here util methods will be added to candidates if the instance is of a suitable type. This does not need to be strictly complete, only the most useful functions may appear.
Takes the last ? tokens of the list that form a simple expression, evaluates it and returns a result. "Simple" means evaluation is known to be side-effect free.
return the last tokens of a list that form an expression to be completed after the next dot, or null if expression cannot be detected. This discards Expressions that could easily have side effects or be long in evaluation. However it assumes that operators can be evaluated without side-effect or long running operation. Users who use operators for which this does not hold should not use tab completion. @return
Build a list of public fields and methods for an object that match a given prefix.
instance
- the objectprefix
- the prefix that must be matchedremoves candidates that, most of the times, a programmer does not want to see in completion
Copyright © 2003-2021 The Apache Software Foundation. All rights reserved.