在Android的面向方面编程 [英] Aspect-oriented programming in android

查看:140
本文介绍了在Android的面向方面编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是实现在Android应用程序面向方面编程(AOP)的最佳方法是什么?

What would be the best way to implement Aspect-oriented programming (AOP) in an Android application?

难道是高效的手机电池?

Would it be efficient with the mobile battery?

推荐答案

这取决于它是如何实现的。

It depends in how it is implemented.

例如,AspectJ的编译时织入将工作在Android上运行,但织造没有。 Android不支持字节code一代。

For instance, AspectJ's compile-time weaving would work on android but runtime weaving do not. Android does not support bytecode generation.

检查吉斯维基

在幕后,方法拦截   通过生成字节code实现的   在运行时。吉斯动态创建   适用拦截器的子类   通过覆盖方法。如果你是一个   不支持字节code平台   代(​​如Android),你   应该使用吉斯没有AOP支持。

Behind the scenes, method interception is implemented by generating bytecode at runtime. Guice dynamically creates a subclass that applies interceptors by overriding methods. If you are on a platform that doesn't support bytecode generation (such as Android), you should use Guice without AOP support.

这篇关于在Android的面向方面编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆