• Public
  • Public/Protected
  • All

Class MethodReflector

Helper class to perform method introspection and dynamic invocation.

This class has symmetric implementation across all languages supported by Pip.Services toolkit and used to support dynamic data processing.

Because all languages have different casing and case sensitivity rules, this MethodReflector treats all method names as case insensitive.


let myObj = new MyObject();

let methods = MethodReflector.getMethodNames();
MethodReflector.hasMethod(myObj, "myMethod");
MethodReflector.invokeMethod(myObj, "myMethod", 123);


  • MethodReflector



Static getMethodNames

  • getMethodNames(obj: any): string[]
  • Gets names of all methods implemented in specified object.


    • obj: any

      an objec to introspect.

    Returns string[]

    a list with method names.

Static hasMethod

  • hasMethod(obj: any, name: string): boolean
  • Checks if object has a method with specified name..


    • obj: any

      an object to introspect.

    • name: string

      a name of the method to check.

    Returns boolean

    true if the object has the method and false if it doesn't.

Static invokeMethod

  • invokeMethod(obj: any, name: string, ...args: any[]): any
  • Invokes an object method by its name with specified parameters.


    • obj: any

      an object to invoke.

    • name: string

      a name of the method to invoke.

    • Rest ...args: any[]

      a list of method arguments.

    Returns any

    the result of the method invocation or null if method returns void.

Generated using TypeDoc