public class FuzzyMethodRt extends FuzzyMethodLookup
| Modifier and Type | Class and Description |
|---|---|
private static class |
FuzzyMethodRt.InternalMethodData
The state used by
MatchMetrics to calculate the match. |
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<MatchMetrics> |
candidates
The candidates used to perform the lookup.
|
private static CentralLogger |
LOG
Logger
|
private java.util.List<InternalEntry> |
overloads
The overloads which will be used to calculate the
candidates. |
private java.lang.Class<? extends _BaseObject_> |
type
The type where the search will start.
|
| Constructor and Description |
|---|
FuzzyMethodRt(java.lang.Class<? extends _BaseObject_> type,
java.util.List<InternalEntry> overloads)
Initialize this instance.
|
| Modifier and Type | Method and Description |
|---|---|
private int |
calcAccessMode(java.lang.Class<?> thisType)
Give the class for the context where this method is being invoked (i.e.
|
protected java.util.List<MatchMetrics> |
candidates(java.lang.String name,
int num,
int access,
boolean isStatic,
boolean internal,
boolean first,
java.util.Set<SignatureKey> exist)
Get the list of all possible methods that could match in this class AND its parent classes.
|
protected java.lang.String |
getClassName()
Get the class name where this method lookup starts from.
|
private java.lang.Class<?>[] |
getInterfaces(java.lang.Class<?> src)
Get the interfaces implemented by this type.
|
private java.lang.Class<?>[] |
getParents(java.lang.Class<?> src)
Get the parents of the given type.
|
private boolean |
isImplemented(java.lang.Class<?> src,
java.lang.Class<?> tgt)
Check if the source class implements the specified interface.
|
protected boolean |
isImplemented(java.lang.String caller,
java.lang.String callee)
Detect if the callee class is an instance of an implemented interface of the caller class.
|
private boolean |
isInheritedFrom(java.lang.Class<?> src,
java.lang.Class<?> tgt,
boolean ifaces,
java.lang.Runnable incrementer)
Check if the source type implements or extends the target type, and calculate the distance from this
parent.
|
protected boolean |
isInheritedFrom(java.lang.String caller,
java.lang.String callee,
java.lang.Runnable incrementer)
Detect if the callee class is an instance of a parent class or an implemented interface of a parent
class, of the caller.
|
protected boolean |
isSetParam(java.lang.String method)
Reports if the class name is Progress.Lang.ParameterList and the method name is
setParameter(). |
InternalEntry |
lookup(java.lang.Class<?> thisType,
java.lang.String methodName,
boolean isStatic,
java.lang.String modes,
java.lang.Object[] args)
Perform a runtime fuzzy lookup of the given method, in the
overloads list. |
private java.lang.Class<?> |
parseObjectSpec(java.lang.String spec)
Parse the given object spec (in the form "object extends _CLS_>" or "jobject extends _CLS_>") and
return the type associated with _CLS_.
|
private ParameterKey[] |
resolveSignature(java.lang.Object[] args,
java.lang.String modes)
Given a list of arguments and their modes, resolve the signature in conversion-compatible mode.
|
fuzzyMethodLookupprivate static final CentralLogger LOG
private final java.lang.Class<? extends _BaseObject_> type
private final java.util.List<InternalEntry> overloads
candidates.private java.util.List<MatchMetrics> candidates
public FuzzyMethodRt(java.lang.Class<? extends _BaseObject_> type, java.util.List<InternalEntry> overloads)
type - The type where the search will start.overloads - The overloads which will be used to calculate the candidates.public InternalEntry lookup(java.lang.Class<?> thisType, java.lang.String methodName, boolean isStatic, java.lang.String modes, java.lang.Object[] args)
overloads list.thisType - The type where the call is being performed (external program or legacy class).methodName - The target method name.isStatic - If true, only static methods will be looked up.
Otherwise any method can be returned.modes - The argument modes.args - The arguments.InternalEntry) or null if none found.protected java.lang.String getClassName()
getClassName in class FuzzyMethodLookupprotected boolean isImplemented(java.lang.String caller,
java.lang.String callee)
isImplemented in class FuzzyMethodLookupcaller - The caller type.callee - The callee type.true if the given class is an implemented interface in this class.protected boolean isInheritedFrom(java.lang.String caller,
java.lang.String callee,
java.lang.Runnable incrementer)
isInheritedFrom in class FuzzyMethodLookupcaller - The caller type.callee - The callee type to check.incrementer - Code to be executed to increment the inheritance level.true if the given class is a parent class or an implemented interface of a parent
class.protected boolean isSetParam(java.lang.String method)
setParameter().isSetParam in class FuzzyMethodLookupmethod - The method name.true if this is a setParameter call.protected java.util.List<MatchMetrics> candidates(java.lang.String name, int num, int access, boolean isStatic, boolean internal, boolean first, java.util.Set<SignatureKey> exist)
candidates in class FuzzyMethodLookupname - Method name.num - Number of parameters.access - Access mode (KW_PUBLIC, KW_PROTECTD or KW_PRIVATE).isStatic - If true, only static methods will be looked up. Otherwise any method can be
returned.internal - true if the lookup is internal to the current class definition.first - true if the first match should be immediately returned as the result.exist - The set of existing methods already represented in the list.private int calcAccessMode(java.lang.Class<?> thisType)
thisType - The type where this method call is being performed.private boolean isImplemented(java.lang.Class<?> src,
java.lang.Class<?> tgt)
src - The source type.tgt - The lookup type.private boolean isInheritedFrom(java.lang.Class<?> src,
java.lang.Class<?> tgt,
boolean ifaces,
java.lang.Runnable incrementer)
src - The source type.tgt - The target type.ifaces - true if implemented interfaces should be checked.incrementer - Code to be executed to increment the inheritance level.private java.lang.Class<?>[] getInterfaces(java.lang.Class<?> src)
src - The type.private java.lang.Class<?>[] getParents(java.lang.Class<?> src)
src - The type.private java.lang.Class<?> parseObjectSpec(java.lang.String spec)
spec - The specification to parse.null if the spec was malformed or if there is no such definition.private ParameterKey[] resolveSignature(java.lang.Object[] args, java.lang.String modes)
args - The arguments.modes - The modes.