<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Applebet</title>
    <description>周五派</description>
    <link>https://applebet.github.io/</link>
    <atom:link href="https://applebet.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 18 May 2020 06:05:27 +0000</pubDate>
    <lastBuildDate>Mon, 18 May 2020 06:05:27 +0000</lastBuildDate>
    <generator>Jekyll v3.8.5</generator>
    
      <item>
        <title>行为模式</title>
        <description>&lt;blockquote&gt;
  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@author javakam&lt;/code&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;访问者模式&quot;&gt;访问者模式&lt;/h1&gt;

&lt;h3 id=&quot;访问者模式是一种行为设计模式-它能将算法与其所作用的对象隔离开来&quot;&gt;访问者模式是一种行为设计模式， 它能将算法与其所作用的对象隔离开来。&lt;/h3&gt;

&lt;h3 id=&quot;访问者模式结构-uml&quot;&gt;访问者模式结构 UML&lt;/h3&gt;

&lt;img src=&quot;https://user-gold-cdn.xitu.io/2020/5/15/17217440b13047df?w=520&amp;amp;h=540&amp;amp;f=png&amp;amp;s=53552&quot; alt=&quot;&quot; /&gt;

&lt;h3 id=&quot;访问者和双分派&quot;&gt;&lt;a href=&quot;https://refactoringguru.cn/design-patterns/visitor-double-dispatch&quot;&gt;访问者和双分派&lt;/a&gt;&lt;/h3&gt;

&lt;h3 id=&quot;示例代码&quot;&gt;示例代码&lt;/h3&gt;

Java 程序库代码中该模式的一些示例&lt;span class=&quot;chpule2&quot;&gt;：&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/AnnotationValue.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;javax.lang.model.element.AnnotationValue&lt;/code&gt;&lt;/a&gt; 和 &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/AnnotationValueVisitor.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;Annotation&amp;shy;Value&amp;shy;Visitor&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/Element.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;javax.lang.model.element.Element&lt;/code&gt;&lt;/a&gt; 和 &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/ElementVisitor.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;Element&amp;shy;Visitor&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/javax/lang/model/type/TypeMirror.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;javax.lang.model.type.TypeMirror&lt;/code&gt;&lt;/a&gt; 和 &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/javax/lang/model/type/TypeVisitor.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;Type&amp;shy;Visitor&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileVisitor.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.nio.file.FileVisitor&lt;/code&gt;&lt;/a&gt; 和 &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/nio/file/SimpleFileVisitor.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;Simple&amp;shy;File&amp;shy;Visitor&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javaee/7/api/javax/faces/component/visit/VisitContext.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;javax.faces.component.visit.VisitContext&lt;/code&gt;&lt;/a&gt; 和 &lt;a href=&quot;https://docs.oracle.com/javaee/7/api/javax/faces/component/visit/VisitCallback.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;Visit&amp;shy;Callback&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  看下 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ElementVisitor&lt;/code&gt; 的源码:
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public interface ElementVisitor&amp;lt;R, P&amp;gt; {
    //访问元素
    R visit(Element var1, P var2);
    default R visit(Element e) {
        return this.visit(e, (Object)null);
    }
    //访问包元素
    R visitPackage(PackageElement var1, P var2);
    //访问一个类型元素
    R visitType(TypeElement var1, P var2);
    //访问一个变量类型
    R visitVariable(VariableElement var1, P var2);
    //访问一个可执行的元素
    R visitExecutable(ExecutableElement var1, P var2);
    //访问一个参数元素
    R visitTypeParameter(TypeParameterElement var1, P var2);
    //处理未知的元素类型 , Java 为后续扩展预留的接口
    //例如后续元素类型增加了, 那么通过这个接口就可以处理上述没有声明的类型
    R visitUnknown(Element var1, P var2);
    
    default R visitModule(ModuleElement e, P p) {
        return this.visitUnknown(e, p);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  Android 程序示例:
&lt;/blockquote&gt;

&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;APT&lt;/code&gt; 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AbstractProcessor.process()&lt;/code&gt; , 而使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;APT&lt;/code&gt;的框架有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Butterknife&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Retrofit&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dagger2&lt;/code&gt;等。

&lt;h1 id=&quot;模板方法模式&quot;&gt;模板方法模式&lt;/h1&gt;

&lt;h3 id=&quot;当你只希望客户端扩展某个特定算法步骤-而不是整个算法或其结构时-可使用模板方法模式&quot;&gt;当你只希望客户端扩展某个特定算法步骤， 而不是整个算法或其结构时， 可使用模板方法模式。&lt;/h3&gt;

&lt;img src=&quot;https://user-gold-cdn.xitu.io/2020/5/18/172254ea60d126c0?w=340&amp;amp;h=380&amp;amp;f=png&amp;amp;s=20730&quot; alt=&quot;&quot; /&gt;

Java 程序库中模版方法的示例&lt;span class=&quot;chpule2&quot;&gt;：&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.io.InputStream&lt;/code&gt;&lt;/a&gt;&lt;span class=&quot;chpule2&quot;&gt;、&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.io.OutputStream&lt;/code&gt;&lt;/a&gt;&lt;span class=&quot;chpule2&quot;&gt;、&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/io/Reader.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.io.Reader&lt;/code&gt;&lt;/a&gt;  和 &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/io/Writer.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.io.Writer&lt;/code&gt;&lt;/a&gt; 的所有非抽象方法&lt;span class=&quot;chpule2&quot;&gt;。&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.util.AbstractList&lt;/code&gt;&lt;/a&gt;&lt;span class=&quot;chpule2&quot;&gt;、&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;&lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/util/AbstractSet.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.util.AbstractSet&lt;/code&gt;&lt;/a&gt; 和 &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;java.util.AbstractMap&lt;/code&gt;&lt;/a&gt; 的所有非抽象方法&lt;span class=&quot;chpule2&quot;&gt;。&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServlet.html&quot;&gt;&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;javax.servlet.http.HttpServlet&lt;/code&gt;&lt;/a&gt;&lt;span class=&quot;chpule2&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;所有默认发送 HTTP 405 &lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;chpuri1&quot;&gt;&lt;span class=&quot;noto noto-open&quot;&gt;“&lt;/span&gt;&lt;/span&gt;方法不允许&lt;span class=&quot;chpule2&quot;&gt;&lt;span class=&quot;noto&quot;&gt;”&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;错误响应的 &lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;code class=&quot;ml&quot;&gt;do&amp;shy;XXX()&lt;/code&gt; 方法&lt;span class=&quot;chpule2&quot;&gt;。&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;你可随时对其进行重写&lt;span class=&quot;chpule2&quot;&gt;。&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;识别方式&lt;span class=&quot;chpule2&quot;&gt;：&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;&lt;/strong&gt;模版方法可以通过行为方法来识别&lt;span class=&quot;chpule2&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;该方法已有一个在基类中定义的&lt;span class=&quot;chpule1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;chpuri1&quot;&gt;&lt;span class=&quot;noto noto-open&quot;&gt;“&lt;/span&gt;&lt;/span&gt;默认&lt;span class=&quot;chpule2&quot;&gt;&lt;span class=&quot;noto&quot;&gt;”&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;行为&lt;span class=&quot;chpule2&quot;&gt;。&lt;/span&gt;&lt;span class=&quot;chpuri2&quot;&gt; &lt;/span&gt;

&lt;hr /&gt;
&lt;blockquote&gt;
  参考:
  &lt;ol&gt;
    &lt;li&gt;&lt;a href=&quot;https://refactoring.guru/&quot;&gt;Refactoring.Guru&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;《Android源码设计模式解析与实战》&lt;/li&gt;
    &lt;li&gt;掘金 👉 &lt;a href=&quot;https://juejin.im/post/5ebe33335188256d5952500c&quot;&gt;https://juejin.im/post/5ebe33335188256d5952500c&lt;/a&gt;  &amp;amp;  &lt;a href=&quot;https://juejin.im/post/5ec1dee45188256d877dc710&quot;&gt;https://juejin.im/post/5ec1dee45188256d877dc710&lt;/a&gt;&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Thu, 14 May 2020 08:34:41 +0000</pubDate>
        <link>https://applebet.github.io/2020/05/14/%E8%A1%8C%E4%B8%BA%E6%A8%A1%E5%BC%8F_%E8%AE%BF%E9%97%AE%E8%80%85%E6%A8%A1%E5%BC%8F%E5%92%8C%E6%A8%A1%E6%9D%BF%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F/</link>
        <guid isPermaLink="true">https://applebet.github.io/2020/05/14/%E8%A1%8C%E4%B8%BA%E6%A8%A1%E5%BC%8F_%E8%AE%BF%E9%97%AE%E8%80%85%E6%A8%A1%E5%BC%8F%E5%92%8C%E6%A8%A1%E6%9D%BF%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F/</guid>
        
        <category>设计模式</category>
        
        
        <category>设计模式</category>
        
      </item>
    
      <item>
        <title>APP 如何适配 ABI</title>
        <description>&lt;blockquote&gt;
  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@author Andrqid&lt;/code&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;app-如何适配-abi&quot;&gt;APP 如何适配 ABI&lt;/h1&gt;

&lt;a href=&quot;https://juejin.im/post/5eae6f86e51d454ddb0b3dc6&quot;&gt;文章链接&lt;/a&gt;
  关于编译apk时如何选择支持哪些版本的ABI，文章做了详细的解析，适当的配置，可以保证应用的兼容性和性能。
</description>
        <pubDate>Thu, 14 May 2020 08:34:41 +0000</pubDate>
        <link>https://applebet.github.io/2020/05/14/ABI%E9%80%82%E9%85%8D/</link>
        <guid isPermaLink="true">https://applebet.github.io/2020/05/14/ABI%E9%80%82%E9%85%8D/</guid>
        
        <category>Android</category>
        
        
        <category>Android</category>
        
      </item>
    
      <item>
        <title>模板页面</title>
        <description>课程地址:
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://ke.qq.com/webcourse/index.html#cid=334710&amp;amp;term_id=100397234&amp;amp;taid=2798467546422134&amp;amp;vid=5285890786251677089&quot;&gt;视频1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ke.qq.com/course/130901?taid=1566219954159445&amp;amp;dialog=1&quot;&gt;视频2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;img src=&quot;/files/android/导图.png&quot; alt=&quot;导图&quot; /&gt;
&lt;h1 id=&quot;base64&quot;&gt;Base64&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Base64 由64个字符组成a-zA-Z0-9…&lt;/li&gt;
  &lt;li&gt;Base64 是一种编码而不是加密;&lt;/li&gt;
  &lt;li&gt;
    缺点👉Base64 会浪费网络带宽,并不高效!!!
  &lt;/li&gt;
  &lt;li&gt;为什么还用 Base64 呢?
很大原因是因为后端开发只会这种早期方式。&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;图片上传的三种方式&quot;&gt;图片上传的三种方式:&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;@POST + @FormUrlEncoded 参数为 @Filed Base64文本&lt;/li&gt;
  &lt;li&gt;@POST + @Multipart 参数为 @Part RequestBody&lt;/li&gt;
  &lt;li&gt;最不常见的: @POST 参数为 @Body RequestBody&lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Thu, 14 May 2020 08:34:41 +0000</pubDate>
        <link>https://applebet.github.io/2020/05/14/%E6%A8%A1%E6%9D%BF/</link>
        <guid isPermaLink="true">https://applebet.github.io/2020/05/14/%E6%A8%A1%E6%9D%BF/</guid>
        
        <category>Android</category>
        
        
        <category>Android</category>
        
      </item>
    
  </channel>
</rss>
