package br.org.senacagil;

import org.springframework.aop.AfterReturningAdvice;
import java.lang.reflect.Method;

public class CountingAfterAdvice implements AfterReturningAdvice {
	private int count = 0;

	public void afterReturning(Object returnValue, Method m, Object[] args, Object target) 
	                                                               throws Throwable {
		++count;
		System.out.println("LOG2 --- " + getCount()+ " After returning method: " + m.getName() + 
				           " returnValue= " + returnValue);
	}

	public int getCount() {
		return count;
	}
}
