classafBedSheet::MethodCall

sys::Obj
  afBedSheet::MethodCall

(Response Object) Use to explicitly invoke Fantom methods.

MethodCall(MyHandler#process, ["arg1", "arg2"]).toImmutableFunc

Note that:

  • if the method belongs to an IoC service, the class instance is obtained from afIoc.
  • if the method belongs to a const class, a new instance is created and cached.
  • non-const classes are cached for the duration of the request only.
  • methods are called using afIoc::Registry.callMethod(...) so may have services as parameters.
args

Source

Obj?[] args

The arguments the method is to be called with

make

Source

new make(Method method, Obj?[] args := Obj#.emptyList())

Creates a MethodCall.

method

Source

const Method method

The method to be called

toImmutableFunc

Source

virtual Func toImmutableFunc()

Returns an immutable func that represents this method call. May be used as a response object itself.

If this MethodCall wraps an instance method (not static) then the func's first (and only) argument must be the target object. Otherwise the func takes no arguments.

Suggest design ideas for implementing Obj.toImmutable()