Java源码阅读绘图规范手册--[捷特版]
工欲善其事必先利其器,磨刀不误砍柴工
最近打算去深读源码,感觉不画图去分析源码根本理不清,也说不清
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源码阅读绘图规范手册--[捷特版]相关推荐
- Java源码阅读之String(4)
Java源码阅读之String(4) 这一篇博客主要阅读String类的查找和替换相关的方法. /**查询当前对象的哈希码,如果当前对象没有计算过哈希码*则计算当前对象的哈希码并赋值给当前对象的has ...
- Java源码阅读学习后的浅析和感悟(JDK篇)(持续更新)
目录 Java源码阅读学习后的浅析和感悟(JKD篇) - 为什么阅读源码 集合框架类 - 为什么会要引入集合 - 集合结构图(部分) ArrayList集合源码分析 - 扩容机制 - 关键方法解释(D ...
- 走过的路-java源码阅读之路
源码阅读,我觉得最核心有三点:技术基础+强烈的求知欲+耐心. 一.人生三种境界: 1.昨夜西风凋碧树,独上高楼望尽天涯路. 2.衣带渐宽终不悔,为伊消得人憔悴. ...
- Java源码阅读的真实体会(一种学习思路)
刚才在论坛不经意间,看到有关源码阅读的 帖子 .回想自己前几年,阅读源码那种兴奋和成就感( 1 ),不禁又有一种激动. 源码阅读,我觉得最核心有三点:技术基础+强烈的求知欲+耐心. 说到技术基础,我 ...
- Java源码阅读的真实体会
刚才在论坛不经意间,看到有关源码阅读的[url=http://www.iteye.com/topic/854647]帖子[/url].回想自己前几年,阅读源码那种兴奋和成就感([url=http:// ...
- java源码阅读Object
1 类注释 Class {@code Object} is the root of the class hierarchy. Every class has {@code Object} as a s ...
- Java源码阅读(类图自动生成工具)
菜鸟上路,在有了基础以后,总需要去阅读大量的优秀的源码,但在面对一个项目工程大量的代码不知道怎么下手.只是跟着敲代码,我觉得这个方法不太妥当. 我是个方法论者,在收集查阅了大量的资料后发现画代码结构图 ...
- java源码阅读LinkedList
1类签名与注释 public class LinkedList<E>extends AbstractSequentialList<E>implements List<E& ...
- Java源码阅读PriorityQueue
1类签名与简介 public class PriorityQueue<E> extends AbstractQueue<E>implements java.io.Seriali ...
- 【源码阅读】Java集合之一 - ArrayList源码深度解读
Java 源码阅读的第一步是Collection框架源码,这也是面试基础中的基础: 针对Collection的源码阅读写一个系列的文章,从ArrayList开始第一篇. ---@pdai JDK版本 ...
最新文章
- 为什么csdn搜索自己文章时,加了英文分号的搜索不了?“ ' ”
- 【机器学习基础】机器学习中“距离与相似度”计算汇总
- 深入研究Servlet线程安全性问题
- leetcode BFS(python+c++)
- Debian——roundcube报错及解决方法
- Rax新手入门 - 快速构建多端应用
- 奖券数目2.1题目描述有些人很迷信数字,比如带“4”的数字,认为和“死”谐音,就觉得不吉利。虽然这些说法纯属无稽之谈,但有时还要迎合大众的需求。某抽奖活动的奖券号码是N位数,要求其中不要出现带
- Qzone 超级补丁热修复方案原理
- 滴滴快车奖励政策,高峰奖励,翻倍奖励,按成交率,指派单数分级(10月17日~10月23日)...
- Python 棋子移动游戏
- 2019.8.22 1.属性
- 使用oc的block方法回调
- 20155305乔磊2016-2017-2《Java程序设计》第三周学习总结
- 网恋多是为自己的“猎艳”心理编织虚幻的梦境
- 计算机科学丛书操作系统概念pdf,操作系统概念 (第9版) PDF英文文字版[5.63M]
- js室内地图开发_室内地图 JavaScript API
- eclipse中使用git提交时忽略不必要的文件
- mac环境安装Eclipse 2020-03版报failed to create the java virtual machine错误的解决
- La Salle-Pui Ching Programming Challenge 2017 Gym - 101522A,B,C,D,H,I,K
- 雅思培训心得(1)摸底测试听力与阅读
热门文章
- 解决UI黑边问题,Alpha Bleeding技术简介
- java 将服务器的图片打包下载成.zip ,通过浏览器下载。
- 【Phusion Passenger】应用服务器
- 金蝶KIS迷你版、标准版年结注意事项!!
- 浅析Tier和Layer的区别
- Java IDEA 编辑器代码前进后退快捷键
- C#VS工程报错:CS0234 命名空间“Microsoft.VisualStudio”中不存在类型或命名空间名“VCProjectEngine(是否缺少程序集引用)
- Flutter水波纹效果
- 那些出其不意给你惊喜的点,重新感受for循环的爱,来自C#
- Failed opening .rdb for saving: Permission denied