方面问题

发布于 2024-08-07 02:59:27 字数 66 浏览 3 评论 0原文

您好,我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懵少女 2024-08-14 02:59:27

我猜问题是,如果我添加方面,是否会创建一个新类。

答案是否定的,因为编织时,无论是在编译时还是在运行时,使用 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.

初懵 2024-08-14 02:59:27

变体是什么意思?
如果您询问 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文