//System.out.println(method.getName()+"running time of"+(endTime-beginTime));
return retVal;
}
});
return proxy;
}
}
interface Advice{
public abstract void beforTime(Method method);
public abstract void afterTime(Method method);
}
class MyAdvice implements Advice{
Long beginTime;
public void beforTime(Method meethod){
System.out.println("到黑马学习啦");
beginTime=System.currentTimeMillis();
}
public void afterTime(Method method){
System.out.println("从黑马毕业要参加工作啦");
Long endTime=System.currentTimeMillis();
System.out.println(method.getName()+" running time of"+(endTime-beginTime));
}
}