package com.hc.jee.springaop.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

import com.hc.jee.springaop.model.Circle;

@Aspect
public class LoggingAspect {



	////////////////
	// JoinPoints
	////////////////
//	@Before ("allCircleMethods()") 
//	public void loggingAdvice(JoinPoint jointPoint) {
//		System.out.println("Advice run. Get method called");
//		System.out.println(jointPoint.toString());
//		Circle cirle = (Circle) jointPoint.getTarget();
//		//...
//	}

//	@Pointcut("within(com.hc.jee.springaop.model.Circle)")
//	public void allCircleMethods() { 
//	}

	////////////////
	// Advice Arguments
	////////////////
	
	@Before("args(String)")
	public void stringArgumentMethods() {
		System.out.println("A method that takes String arguments has been called");
	}
	
	@Before("args(name)")
	public void stringArgumentMethods2(String name) {
		System.out.println("A method that takes String arguments has been called. "
				+ "The value is " + name);
	}

}
