I’m trying to write a Java program such that after calling a methodA(), first a method named methodBeforeA() is called and then methodA() gets executed followed by another method being called named, methodAfterA(). This is very similar to what Junit does using Annotations (using the @Before, @Test, @After), so i think it should be possible using reflection but i don’t have a very good clue.
Share
AspectJ allows you to specify cutpoints before method entry and after method exit.
http://www.eclipse.org/aspectj/doc/released/progguide/starting-aspectj.html