Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : Invoke( ) method (Class)
 

Invoke( ) method (Class)

Dynamically invokes a method whose name and parameters must be set at run time. The Invoke( ) method is one of several reflection methods of the Progress.Lang.Class class that provide type information about a class or interface at run time.
Return type: Any data type
Access: PUBLIC
Applies to: Progress.Lang.Class class

Syntax

Four overloaded versions are supported. The first version is used to invoke a method that does not take any parameters.
[ return-value = ] class-reference:Invoke (
  INPUT object-reference AS Progress.Lang.Object ,
  INPUT method-name AS CHARACTER )
The second overloaded version is used to invoke a method that takes zero or more parameters. Since parameterlist-object can be built with zero or more parameters, this version of the Invoke( ) method can be used to invoke any method, even those that do not take any arguments.
[ return-value = ] class-reference:Invoke (
  INPUT object-reference AS Progress.Lang.Object ,
  INPUT method-name AS CHARACTER ,
  INPUT parameterlist-object AS Progress.Lang.ParameterList )
The third overloaded version is used when invoking a static method that does not take any parameters.
[ return-value = ] class-reference:Invoke (
INPUT method-name AS CHARACTER )
The fourth overloaded version is used when invoking a static method that takes zero or more parameters. Since parameterlist-object can be built with zero or more parameters, this version of the Invoke( ) method can be used to invoke any static method, even those that do not take any arguments.
[ return-value = ] class-reference:Invoke (
  INPUT method-name AS CHARACTER ,
  INPUT parameterlist-object AS Progress.Lang.ParameterList)
Element descriptions for the syntax diagrams follow:
return-value
An optional data element which is assigned the return value from the invoked, non-void method. This return value can have any valid ABL or .NET method return type. The AVM checks return-value at run time for data type compatibility with what is actually returned by the method.
class-reference
An object reference to the Progress.Lang.Class class instance containing the type information.
object-reference
A reference to the object that contains the method you want to invoke, and whose type is compatible with the class-reference object. When invoking a static method, the Unknown value (?) is passed for this parameter.
method-name
A CHARACTER expression that evaluates at run time to the name of the method to be invoked.
parameterlist-object
An instance of the Progress.Lang.ParameterList class.
Note: The DYNAMIC-INVOKE function provides similar functionality to the Invoke( ) method. The advantage of the former is that it has a fixed, compile-time parameter list and does not require the creation of a Progress.Lang.ParameterList object at run time.

See also

DYNAMIC-INVOKE function, DYNAMIC-NEW statement, New( ) method, NumParameters property (ParameterList), Progress.Lang.ParameterList class, SetParameter( ) method (Class)