AOP切面編程 的切面類

package com.gxa.bj.aspect;


import org.aspectj.lang.ProceedingJoinPoint;


/**
 * 這是一個切面的類
 * @author Administrator
 *
 */
public class ZhuangBei {
//增強方法前調用
public void before(){
System.out.println("選擇一件裝備");
}
/**
* 正在加強的方法
* @param joinPoint
* @return
* @throws Throwable
*/
public Object around(ProceedingJoinPoint joinPoint) throws Throwable{
Object result  = joinPoint.proceed();
System.out.println("正在加強的方法");
System.out.println("殺傷力增加兩倍,防禦力增加兩倍");
return result;
}
public void after(){
System.out.println("裝備使用完畢");
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章