Loggable.java
1 2 3 | package com.mugil.shapes; public @interface Loggable { } |
.java
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 | @Aspect public class LoggingAspect { @Around ( "@annotation(com.mugil.shapes.Loggable)" ) public void LoggingAdvice2(ProceedingJoinPoint pjp) { Object objObject = null ; try { System.out.println( "Code before Method Execution Goes here" ); objObject = pjp.proceed(); System.out.println( "Code after Method Execution Goes here" ); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); } } } |
Triangle.xml
01 02 03 04 05 06 07 08 09 10 11 12 | public class Triangle { private String name; @Loggable public String getName() { return name; } . . } |