Package org.openl.rules.types
Class OpenMethodDispatcher
- java.lang.Object
-
- org.openl.rules.types.OpenMethodDispatcher
-
- All Implemented Interfaces:
INamedThing,IMethodCaller,Invokable,IOpenMember,IOpenMethod,IOpenMethodHeader
- Direct Known Subclasses:
MatchingOpenMethodDispatcher
public abstract class OpenMethodDispatcher extends Object implements IOpenMethod
Class that decorates theIOpenMehtodinterface for method overload support.- Author:
- Alexey Gamanovich
-
-
Field Summary
-
Fields inherited from interface org.openl.base.INamedThing
EMPTY, LONG, REGULAR, SHORT
-
Fields inherited from interface org.openl.types.IOpenMethod
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedOpenMethodDispatcher()OpenMethodDispatcher(IOpenMethod delegate, XlsModuleOpenClass xlsModuleOpenClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMethod(IOpenMethod method)Try to add method as overloaded version of decorated method.protected abstract IOpenMethodfindMatchingMethod(List<IOpenMethod> candidates, IRuntimeContext context)Resolve best matching method to invoke.IOpenMethodfindMatchingMethod(IRuntimeEnv env)Finds appropriate method using runtime context.List<IOpenMethod>getCandidates()XlsModuleOpenClassgetDeclaringClass()Gets the declaring class.abstract TableSyntaxNodegetDispatcherTable()StringgetDisplayName(int mode)Gets the user-friendly name.IMemberMetaInfogetInfo()Getsnull.IOpenMethodgetMethod()Getsthis.StringgetName()Gets the method name.IMethodSignaturegetSignature()Gets the signature of method.IOpenMethodgetTargetMethod()IOpenClassgetType()Gets the type of method.Objectinvoke(Object target, Object[] params, IRuntimeEnv env)Invokes appropriate method using runtime context.booleanisConstructor()booleanisStatic()
-
-
-
Constructor Detail
-
OpenMethodDispatcher
protected OpenMethodDispatcher()
-
OpenMethodDispatcher
public OpenMethodDispatcher(IOpenMethod delegate, XlsModuleOpenClass xlsModuleOpenClass)
-
-
Method Detail
-
getSignature
public IMethodSignature getSignature()
Gets the signature of method.- Specified by:
getSignaturein interfaceIOpenMethodHeader
-
getDeclaringClass
public XlsModuleOpenClass getDeclaringClass()
Gets the declaring class.- Specified by:
getDeclaringClassin interfaceIOpenMember
-
getInfo
public IMemberMetaInfo getInfo()
Getsnull. The decorator hasn't info about overloaded methods.- Specified by:
getInfoin interfaceIOpenMember
-
getType
public IOpenClass getType()
Gets the type of method.- Specified by:
getTypein interfaceIOpenMember
-
isStatic
public boolean isStatic()
- Specified by:
isStaticin interfaceIOpenMember
-
isConstructor
public boolean isConstructor()
- Specified by:
isConstructorin interfaceIOpenMethod
-
getDisplayName
public String getDisplayName(int mode)
Gets the user-friendly name.- Specified by:
getDisplayNamein interfaceINamedThing
-
getName
public String getName()
Gets the method name.- Specified by:
getNamein interfaceINamedThing
-
getMethod
public IOpenMethod getMethod()
Getsthis. The decorator cannot resolve which overloaded method should be returned.- Specified by:
getMethodin interfaceIMethodCaller
-
getCandidates
public List<IOpenMethod> getCandidates()
-
invoke
public Object invoke(Object target, Object[] params, IRuntimeEnv env)
Invokes appropriate method using runtime context.
-
findMatchingMethod
public IOpenMethod findMatchingMethod(IRuntimeEnv env)
Finds appropriate method using runtime context. This method used to optimize runtime where the same method is used more that one time.
-
addMethod
public void addMethod(IOpenMethod method)
Try to add method as overloaded version of decorated method.- Parameters:
method- method to add
-
findMatchingMethod
protected abstract IOpenMethod findMatchingMethod(List<IOpenMethod> candidates, IRuntimeContext context)
Resolve best matching method to invoke.- Parameters:
candidates- list of candidatescontext- runtime context- Returns:
- method to invoke
-
getTargetMethod
public IOpenMethod getTargetMethod()
-
getDispatcherTable
public abstract TableSyntaxNode getDispatcherTable()
-
-