My first AOP
Here’s what I did. 01: I created a support project which just has a logger class in it. namespace EcoSupport.pas; interface uses System.Collections.Generic, System.Linq, System.Text; type Logger = public class private protected public class procedure Log(Message : String); end; implementation class procedure Logger.Log(Message : String); begin System.Diagnostics.Debug.WriteLine(’Log: ’ + Message); end; end. 02: I created an Aspect which decorates methods, giving me the opportunity to intercept all method calls on the class it decorates. namespace EcoAspects; interface uses System.Collections.Generic, System.Linq, System.Text, RemObjects.Oxygene.Cirrus, EcoSupport; type [AttributeUsage(AttributeTargets.Class)] LogAspect = public class(System.Attribute, RemObjects.Oxygene.Cirrus.IMethodImplementationDecorator) private protected public method HandleImplementation(Services: IServices; aMethod: IMethodDefinition); end; implementation method