Android开源项目发现--- 工具类依赖注入DI篇(持续更新)

通过依赖注入减少View、服务、资源简化初始化,事件绑定等重复繁琐工作
1. AndroidAnnotations(Code Diet) android快速开发框架
项目地址:https://github.com/excilys/androidannotations
文档介绍:https://github.com/excilys/androidannotations/wiki
官方网站:http://androidannotations.org/
特点:(1)依赖注入:包括view,extras,系统服务,资源等等
(2)简单的线程模型,通过annotation表示方法运行在ui线程还是后台线程
(3)事件绑定:通过annotation表示view的响应事件,不用在写内部类
(4)REST客户端:定义客户端接口,自动生成REST请求的实现
(5)没有你想象的复杂:AndroidAnnotations只是在在编译时生成相应子类
(6)不影响应用性能:仅50kb,在编译时完成,不会对运行时有性能影响。
PS:与roboguice的比较:roboguice通过运行时读取annotations进行反射,所以可能影响应用性能,而AndroidAnnotations在编译时生成子类,所以对性能没有影响

 

2. roboguice 帮你处理了很多代码异常,利用annotation使得更少的代码完成项目
项目地址:https://github.com/roboguice/roboguice
文档介绍:https://github.com/roboguice/roboguice/wiki

 

3. butterknife 利用annotation帮你快速完成View的初始化,减少代码
项目地址:https://github.com/JakeWharton/butterknife
文档介绍:http://jakewharton.github.io/butterknife/

 

4. Dagger 依赖注入,适用于Android和Java
项目地址:https://github.com/square/dagger
文档介绍:http://square.github.io/dagger/

 

posted @ 2014-03-01 13:54  Leo的银弹  阅读(550)  评论(0编辑  收藏  举报