How to Implement Chain of Command (CoC)

The following code example shows how the class must be declared to use CoC. When the ExampleClass.doSomething() method is called, the code will first run all the code before the next keyword. Then, the original code in the ExampleClass.doSomething() method will run. Finally, all code after the next keyword will run.

[ExtensionOf(classStr(ExampleClass))]
final class ExampleClass_Extension
{
str doSomething(int arg)
{
// Custom logic before standard code.
var s = next doSomething(arg);
// Custom logic after standard code.
return s;
}
}

Leave Comment

Your email address will not be published. Required fields are marked *