Java AOP

AspectJ Notes: Aspect Oriented Programming allows you to achieve an extra level of separation of concerns ontop of OOP methodology.

Key terms:
– Pointcut defines wherein the code a joinpoint (injection is what they should’ve called it) will occur.
– Advice defines what happens at the specific joinpoint.
– Weaving is the process of injecting the advice into the joinpoints.

Example code:

public aspect LicenseFee {

// playing with this to see if I can get this to work
// eclipse constantly checks to see if you actually are implementing the method before weaving occurs
// almost like it actively weaves before runtime, no wonder my computer is so slow running this thing
// so that means that when I go to run tests, some errors may occur but it should be okay/runnable despite the fact

pointcut test(): target(Main) &&
(call(void testSaveAccount()));

after(): test(){
System.out.println("TestSaveAccount called");
}

pointcut test2(): target(Main) &&
(call(void testOpenAccount()));

before(): test2(){
System.out.println("Derp");
}

}

Eclipse Semantics for Advice