Arouter源码分析
Arouter核心请求类图

Arouter 和 _Arouter 的关系
_Arouter主要是处理Arouter里面的具体实现。

Arouter 核心类Navigation 方法
1.所示位置就是经过一系列类注解扫描器 拿到真实的clazz 实现目标 这一具体流程我们逐步进行分析
2.这就解释找不到跳转目标或者路径编写错误时候 那个toast哪里来的了。
3.看下入参的postcard 这个我们展开看一下

Navigation 方法的 Postcard
1.public final class Postcardextends RouteMeta{}
2.它的核心作用是 path url的格式化和分组,当然不仅仅是这些 withObject、withString、withBoolean 是对路由跳转数据的一些封装。入下图看的更清晰。

_navigation 的方法
private Object_navigation(final Context context, final Postcard postcard, final int requestCode, final NavigationCallback callback) {
switch (postcard.getType()) {
case ACTIVITY:
..
case PROVIDER:
case BOARDCAST:
case CONTENT_PROVIDER:
case FRAGMENT:
case METHOD:
case SERVICE:
Class fragmentMeta = postcard.getDestination();通过postcard.getDestination()获取真实的跳转类 fragment 同理,不在贴图解释。

这么一分析基本流程是大概有了的 ,但是路由表 @Router()的路径怎么生成的呢?
还记得LogisticsCenter.completion(postcard); 这行代码吗?我们详细的进入看看。
LogisticsCenter的粗读
看到这一大堆的path 是否有点明白了。这里面的
Warehouse:可以理解为存储路由元数据的容器,包括:路由关系、拦截器、provider的映射关系等。
RouteMeta:既持有activity等对应跳转类信息。

看到了这个那个这些路由表的数据从哪来的呢?
由元数据RouteMeta是从实现了IRouteGroup接口的实例中load进来的,这个实现了IRouteGroup接口的类在哪?何时load进Warehouse?在LogisticsCenter.init()方法中看到了点东西。

这个方法承担了太多,我们去看下,?? 看到设计者起的名字了吗?路由数据解析?路径跳转等数据来源的问题也解释清楚了。

跳转的回调
这里面跳转的回调再如下方法中

核心类
标记一下我们今天遇到的几个核心类

tips:这里我们仅仅粗看一下流程,对注解Aop注解生成comper包的内容没有详细的去分析和分组的东西,喜欢的自己继续分析。我们后面再继续完善更新。