方面问题
您好,我是 AspectJ 的新手,我想知道是否使用 Aspects 创建类的变体 - 我也会创建该类的另一个实例吗?
Hi I am new to AspectJ and I would like to find out if creating variants of a class using Aspects - I will create another instance of the class as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜问题是,如果我添加方面,是否会创建一个新类。
答案是否定的,因为编织时,无论是在编译时还是在运行时,使用 AspectJ 都会将更改添加到受切面影响的类中,因此不会创建新的类,而只是字节码因为原来的班级和最终的班级是不同的。
I am guessing that the question is, if I am adding aspects would a new class be created.
The answer is no, as the weaving, either when compiling or at run-time, using AspectJ, will add the changes to the classes that are affected by the aspects, so there is no new class created, it is just that the byte code for the original class and the final class are different.
变体是什么意思?
如果您询问 AspectJ 是否实例化您的类的副本,答案是否。
AspectJ 使用名为
proxy
的设计模式来拦截对类的调用。What do you mean by variants?
If you are asking if AspectJ instantiates copies of your class, the answer is no.
AspectJ uses a design pattern called
proxy
to intercept calls to your class.