Java设计模式 —— 工厂方法(Factory Method)模式 、抽象工厂(Abstract Factory)模式

工厂模式的定义

“Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.”(在基类中定义创建对象的一个接口,让子类决定实例化哪个类。工厂方法让一个类的实例化延迟到子类中进行。)

  • 简单工厂(Simple Factory)模式,又称静态工厂方法模式(Static Factory Method Pattern)。
  • 工厂方法(Factory Method)模式,又称多态性工厂(Polymorphic Factory)模式或虚拟构造子(Virtual Constructor)模式;
  • 抽象工厂(Abstract Factory)模式,又称工具箱(Kit 或Toolkit)模式。

Java设计模式 —— 单例模式(Singleton)

单例模式最初的定义出现于《设计模式》(艾迪生维斯理, 1994):“保证一个类仅有一个实例,并提供一个访问它的全局访问点。”

JAVA六大设计原则 和 23种设计模式

相关书籍:《大话设计模式》、《Java设计模式》、《设计模式之禅》、《研磨设计模式》、《Head First 设计模式》

JAVA六大设计原则

JAVA设计模式提供六个基本原则,分别是:

  1. 开闭原则(OCP) - The Open-Closed Principle
  2. 单一职责原则(SRP) - Single Responsibility Principle
  3. 里氏替换原则(LSP) - Liskov Substitution Principle
  4. 依赖倒置原则(DIP) - Dependency Inversion Principle
  5. 接口隔离原则(ISP) - Interface Segregation Principle
  6. 迪米特法则(DP) - Demeter Principle

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

ChkBugReport工具 for Android 2

chkbugreport扩展功能

Extending chkbugreport

  1. Java plugin:需要自己添加插件功能扩展 ExternalPlugin,并实现 initExternalPlugin 函数。麻烦,还需要 jar 文件~~~

  2. XML Plugin:只需 xml 要按照特定格式配置就可,但是功能有局限性。

chcp 修改显示格式

CHCP 65001修改成 utf-8 , cmd重启不生效

1 win键+R打开“运行”对话框,输入regedit打开注册表编辑器。
2 找到 [HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
3 修改”CodePage”=dword:000003a8(或者将进制改为十进制,然后输入936就可以了)

ChkBugReport工具 for Android 1

BugReport

Android 的 BugReport 一般是 .txt 结尾的文本文件,也有可能是 .log。当然了,命名没有限定。不要慌实质是一样的,就全部当成 .txt
获取BugReport文件:adb bugreport > bugreport.txt

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×