package org.sistema.spring.aspects.monitors;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;

/**
 * Represents a class to monitor a circuit.
 * 
 * @author Eugenia Pérez Martínez
 *
 */
@Aspect
public class MonitoringCircuit {

	/**
	 * called after Circuit.difficulty method call returns value we get the
	 * returning value through returning param
	 * 
	 * @param joinPoint
	 * @param difficulty
	 */
	@AfterReturning(value = "execution(* org.sistema.spring.aspects.models.Circuit.difficulty(..))", returning = "difficultyValue")
	public void movingKart(JoinPoint joinPoint, int difficultyValue) {
		// join.Point.getThis : the caller object
		System.out.println(joinPoint.getThis().toString()
				+ " Circuit difficulty: " + difficultyValue);
	}
}
