简体   繁体   English

类的每个方法的观察者

[英]Observer for each method of a class

I want to keep observer for each method in java ie if any of method is called, i should be notified. 我想为Java中的每个方法保留观察者,即如果调用了任何方法,则应通知我。 or if any of member variable is updated, i should be notified. 或如果任何成员变量已更新,则应通知我。 Is there any java framework to do that ? 是否有任何Java框架可以做到这一点?

You should have a look at AspectJ . 您应该看看AspectJ This framework allows you to add hooks for method invocations and field updates. 该框架允许您为方法调用和字段更新添加挂钩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM