工欲善其事必先利其器,磨刀不误砍柴工

最近打算去深读源码,感觉不画图去分析源码根本理不清,也说不清
UML是分析类和类的关系,具体的类内部貌似没有图形机制,没有条件就创造条件呗
借此机会本人自定义一套图形绘图表示规范,并恬不知耻地称为捷型图
目的为了明确各种元素的图形表示,来表述与分析源码具体运行逻辑

为了避免每张图都加个图例,这里成文统一描述一下


一、常用表示

1.访问限制类型

无形状限定,修饰中(左上角)见色如见人


2.常见修饰符

三角形,放在左上角


3.类相关

4.方法与变量

5.关联线

表述无歧义情况下箭头,数字可略


6.uml线

二.其他不常用:

1.第一组

//待续...


三、几个小例子说明一下

1.类例子
ActivityThread是一个public final的普通类
ApplicationThread 是一个private的内部类 , 并处于 ActivityThread中
复制代码

2.方法与变量例子

3.sendBroadcast的第一层关系
在Activity中调用sendBroadcast,会调用ContextWrapper的sendBroadcast方法
sendBroadcast会使用ContextWrapper的成员变量mBase的sendBroadcast方法
而mBase实际上来源于ContextImpl,而ContextImpl是一个Context类,
ContextImpl的sendBroadcast方法调用ActivityManagerNative.getDefault().broadcastIntent发送广播  这样就将工作焦点指向ActivityManagerNative,可以进行第二层的绘制,也就是分析
ActivityManagerNative,上面的四行话解释和下面的图你更喜欢哪个?
成年人的世界没有单选题,当然选择都要,图文结合,更能形象说明
复制代码

4.捷型图示例

下图是基于下面类绘制的图形,有什么好的意见或建议欢迎留言,
目前使用processon在线绘图工具,以后有时间开发个小软件来绘制感觉挺不错,
再加个一键生成什么的就更棒了...

/** This file is auto-generated.  DO NOT MODIFY.* Original file: J:\\Java\\Android\\LeverUp\\TolyService\\app\\src\\main\\aidl\\com\\toly1994\\tolyservice\\IMusicPlayerService.aidl*/
package com.toly1994.tolyservice;
// Declare any non-default types here with import statementspublic interface IMusicPlayerService extends android.os.IInterface {/*** Local-side IPC implementation stub class.*/public static abstract class Stub extends android.os.Binder implements com.toly1994.tolyservice.IMusicPlayerService {private static final java.lang.String DESCRIPTOR = "com.toly1994.tolyservice.IMusicPlayerService";/*** Construct the stub at attach it to the interface.*/public Stub() {this.attachInterface(this, DESCRIPTOR);}/*** Cast an IBinder object into an com.toly1994.tolyservice.IMusicPlayerService interface,* generating a proxy if needed.*/public static com.toly1994.tolyservice.IMusicPlayerService asInterface(android.os.IBinder obj) {if ((obj == null)) {return null;}android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);if (((iin != null) && (iin instanceof com.toly1994.tolyservice.IMusicPlayerService))) {return ((com.toly1994.tolyservice.IMusicPlayerService) iin);}return new com.toly1994.tolyservice.IMusicPlayerService.Stub.Proxy(obj);}@Overridepublic android.os.IBinder asBinder() {return this;}@Overridepublic boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {java.lang.String descriptor = DESCRIPTOR;switch (code) {case INTERFACE_TRANSACTION: {reply.writeString(descriptor);return true;}case TRANSACTION_stop: {data.enforceInterface(descriptor);this.stop();reply.writeNoException();return true;}case TRANSACTION_pause: {data.enforceInterface(descriptor);this.pause();reply.writeNoException();return true;}case TRANSACTION_start: {data.enforceInterface(descriptor);this.start();reply.writeNoException();return true;}case TRANSACTION_prev: {data.enforceInterface(descriptor);this.prev();reply.writeNoException();return true;}case TRANSACTION_next: {data.enforceInterface(descriptor);this.next();reply.writeNoException();return true;}case TRANSACTION_release: {data.enforceInterface(descriptor);this.release();reply.writeNoException();return true;}case TRANSACTION_isPlaying: {data.enforceInterface(descriptor);boolean _result = this.isPlaying();reply.writeNoException();reply.writeInt(((_result) ? (1) : (0)));return true;}case TRANSACTION_seek: {data.enforceInterface(descriptor);int _arg0;_arg0 = data.readInt();this.seek(_arg0);reply.writeNoException();return true;}case TRANSACTION_create: {data.enforceInterface(descriptor);java.util.List<java.lang.String> _arg0;_arg0 = data.createStringArrayList();this.create(_arg0);reply.writeNoException();return true;}default: {return super.onTransact(code, data, reply, flags);}}}private static class Proxy implements com.toly1994.tolyservice.IMusicPlayerService {private android.os.IBinder mRemote;Proxy(android.os.IBinder remote) {mRemote = remote;}@Overridepublic android.os.IBinder asBinder() {return mRemote;}public java.lang.String getInterfaceDescriptor() {return DESCRIPTOR;}/*** Demonstrates some basic types that you can use as parameters* and return values in AIDL.*/@Overridepublic void stop() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_stop, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}@Overridepublic void pause() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_pause, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}@Overridepublic void start() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_start, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}@Overridepublic void prev() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_prev, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}@Overridepublic void next() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_next, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}@Overridepublic void release() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_release, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}@Overridepublic boolean isPlaying() throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();boolean _result;try {_data.writeInterfaceToken(DESCRIPTOR);mRemote.transact(Stub.TRANSACTION_isPlaying, _data, _reply, 0);_reply.readException();_result = (0 != _reply.readInt());} finally {_reply.recycle();_data.recycle();}return _result;}@Overridepublic void seek(int pre_100) throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);_data.writeInt(pre_100);mRemote.transact(Stub.TRANSACTION_seek, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}
//加in@Overridepublic void create(java.util.List<java.lang.String> filePaths) throws android.os.RemoteException {android.os.Parcel _data = android.os.Parcel.obtain();android.os.Parcel _reply = android.os.Parcel.obtain();try {_data.writeInterfaceToken(DESCRIPTOR);_data.writeStringList(filePaths);mRemote.transact(Stub.TRANSACTION_create, _data, _reply, 0);_reply.readException();} finally {_reply.recycle();_data.recycle();}}}static final int TRANSACTION_stop = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);static final int TRANSACTION_pause = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);static final int TRANSACTION_start = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);static final int TRANSACTION_prev = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);static final int TRANSACTION_next = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);static final int TRANSACTION_release = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);static final int TRANSACTION_isPlaying = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);static final int TRANSACTION_seek = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);static final int TRANSACTION_create = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);}/*** Demonstrates some basic types that you can use as parameters* and return values in AIDL.*/public void stop() throws android.os.RemoteException;public void pause() throws android.os.RemoteException;public void start() throws android.os.RemoteException;public void prev() throws android.os.RemoteException;public void next() throws android.os.RemoteException;public void release() throws android.os.RemoteException;public boolean isPlaying() throws android.os.RemoteException;public void seek(int pre_100) throws android.os.RemoteException;
//加inpublic void create(java.util.List<java.lang.String> filePaths) throws android.os.RemoteException;
}
复制代码

杂篇:Java源码阅读绘图规范手册--[捷特版]相关推荐

  1. Java源码阅读之String(4)

    Java源码阅读之String(4) 这一篇博客主要阅读String类的查找和替换相关的方法. /**查询当前对象的哈希码,如果当前对象没有计算过哈希码*则计算当前对象的哈希码并赋值给当前对象的has ...

  2. Java源码阅读学习后的浅析和感悟(JDK篇)(持续更新)

    目录 Java源码阅读学习后的浅析和感悟(JKD篇) - 为什么阅读源码 集合框架类 - 为什么会要引入集合 - 集合结构图(部分) ArrayList集合源码分析 - 扩容机制 - 关键方法解释(D ...

  3. 走过的路-java源码阅读之路

    源码阅读,我觉得最核心有三点:技术基础+强烈的求知欲+耐心. 一.人生三种境界: 1.昨夜西风凋碧树,独上高楼望尽天涯路.           2.衣带渐宽终不悔,为伊消得人憔悴.           ...

  4. Java源码阅读的真实体会(一种学习思路)

    刚才在论坛不经意间,看到有关源码阅读的 帖子 .回想自己前几年,阅读源码那种兴奋和成就感( 1 ),不禁又有一种激动.  源码阅读,我觉得最核心有三点:技术基础+强烈的求知欲+耐心. 说到技术基础,我 ...

  5. Java源码阅读的真实体会

    刚才在论坛不经意间,看到有关源码阅读的[url=http://www.iteye.com/topic/854647]帖子[/url].回想自己前几年,阅读源码那种兴奋和成就感([url=http:// ...

  6. java源码阅读Object

    1 类注释 Class {@code Object} is the root of the class hierarchy. Every class has {@code Object} as a s ...

  7. Java源码阅读(类图自动生成工具)

    菜鸟上路,在有了基础以后,总需要去阅读大量的优秀的源码,但在面对一个项目工程大量的代码不知道怎么下手.只是跟着敲代码,我觉得这个方法不太妥当. 我是个方法论者,在收集查阅了大量的资料后发现画代码结构图 ...

  8. java源码阅读LinkedList

    1类签名与注释 public class LinkedList<E>extends AbstractSequentialList<E>implements List<E& ...

  9. Java源码阅读PriorityQueue

    1类签名与简介 public class PriorityQueue<E> extends AbstractQueue<E>implements java.io.Seriali ...

  10. 【源码阅读】Java集合之一 - ArrayList源码深度解读

    Java 源码阅读的第一步是Collection框架源码,这也是面试基础中的基础: 针对Collection的源码阅读写一个系列的文章,从ArrayList开始第一篇. ---@pdai JDK版本 ...

最新文章

  1. 从0实现一个tinyredux
  2. Binary Tree Level Order Traversal II leetcode java
  3. python 百度词典_python在线抓取百度词典的翻译结果翻译单词
  4. extjs 表单验证实例
  5. java语言如何跳转界面_在java中spring mvc页面如何跳转,详细图解
  6. hdu 1316 斐波那契数
  7. Meta Learning | 加了元学习之后,少样本学习竟然可以变得这么简单!
  8. 一位编辑人员给作者们的市场汇报——冰冰子组织的市场宣传活动介绍之交互设计篇
  9. 2021-06-14 阻塞队列的方法
  10. 耳机煲机软件测试工资,耳机煲机有必要吗_耳机煲机正确方法
  11. Linux驱动学习--ALSA框架(二)声卡的创建--以SCO虚拟声卡为例
  12. # 稳了github star突破9k即时通讯IM开源项目OpenIM版本发布-生产环境重点关注
  13. python的内存管理
  14. 雪花算法中机器id保证全局唯一
  15. Windows 32位下cocos2d-x2.2.0Android环境搭建
  16. jeDate—选择日期后,再点开重新选择时间,日期会被置为今日日期
  17. 时序分析基础(1)----寄存器时序分析模型
  18. C++PTA习题总结(三)
  19. 现在Php、Java、Python横行霸道的市场,C++程序员们都在干什么呢?
  20. 百度熊掌号运营位设置

热门文章

  1. Excel 数组公式的简单使用
  2. openwrt查看flash、RAM、CPU信息【转】
  3. JS下载文件、图片,JS打包下载
  4. c语言中row是什么意思中文,row是什么意思
  5. mybatis看这一篇就够了,简单全面一发入魂
  6. turf.js字典——查询turf库的所有方法及用途
  7. 【bzoj3034】Heaven Cow与God Bull
  8. 4412——Linux驱动入门01
  9. 百度AI车牌识别测试
  10. Linux从入门到精通二(Windows:你知道我的兄弟Linux吗?)