创建型模式分为五类:工厂方法模式、抽象工厂模式、单例模式、建造者模式、原型模式
一、工厂方法模式:接口-实现类、工厂类
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAq0AAAFDCAIAAACfmKCTAAAbOklEQVR4nO3d328j12EvcP+VedFTHov0As1LF/tSwEAfLpAnBXdTBAIKtzFuC3aTYgsni22umhuhaRVbtnxjM8FyYco1N1pdwlpV6v6Q1ytOH0Ykh+SQIqXRHJ4znw++CLhjckQxh3O+nB/iOxkA0FTvhH4CsJTXby72vjz76cd9kfTyzbcXod9hNJceQBxev7n48a//uLHVFkkvZ6/fhn6H0Vx6AHHQAyTh6AEEpAcQBz1AEo4eQEB6AHHQAyTh6AEEpAcQBz1AEo4eQEB6AHHQAyTh6AEEpAcQBz1AEo4eQEB6AHG4eQ/Isqz0tkjw6AEEpAcQh2p7wOw/RwvnCT5VSMLRAwhIDyAOVfWA0pVP3WfeY0VuKXoAAekBxOEmPaC4no2FBwgyPUBCRA8gID2AOCzuAXf3z7OT/t2FC7OZ6T+bmd1nl5Qs3z6d/VnlC0WWix5AQHoAcZjbA7ZPsyzLDnpXLswqPC5wv3+YZVl2eu/KhSJLRA8gID2AOJT0gKUbQJ58PcV/lt6ndDM9Z3lvL8tmdgOULhRZFD2AgPQA4jCvBxzuP7ly4WglG9WeJ5jvAJia8ksXiiyMHkBAegBxmHdc4O7+eTYz8ZcuzMrm++x65wlqAFJp9AAC0gOIQ4XnCeYrnFpY/E+lxndznqBUHT2AgPQA4nAbf0cou971AiJVRw8gID2AONywB+Qr2Zg8V2BjThsQqTl6AAHpAcTB9wxJwtEDCEgPIA56gCQcPYCA9ADioAdIwtEDCEgPIA56gCQcPYCA9ADioAdIwtEDCEgPIA56gCQcPYCA9ADioAdIwtEDCEgPIA56gCQcPYCA9ADioAdIwtEDCEgPIA56gCQcPYCA9ADioAdIwtEDCEgPIA56gCQcPYCA9ADiUF8P2D7NstN7oScGaVT0AALSA4hDeQ+43z8c3mFvu6KNsh4g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/Uv45tdPqFT53lj+f4e2JdV4uLHvs2fw94aVPvnDnyZ3elx+dy37uEs9w4kUeP72Sz9Pjl6KsB4z/WdwfMP2jl+8BJTN9ycsy54UtXf+t0wOonx5AfG5+XKDeHnD58Hx398xn91V6QMnn/sp6wGa7/Oeu0AMW/WrTL8X1e0C+k6D87MvpVyNfT+GUjjk9oPw8APsDaAQ9gPhUdlxgYn/4eJov7A9f4rhAcQf7pM5up7j3frNdesh5zkfe0uMCJdPSgh4w++QLdy49LlD6c0tfnNnfuvxXG69t+qW4dg9od+efpznzavR6d1rdzfHCspdl3nkAzg+gGfQA4lPheYKz58fd2e2tep5gYcfy1JQ8/uRaPPI9eefys/AKxzKORpfgl/2gRfsDZn7NmcPnM+cJlv7cshen5MnMLikcbp//Ukwfwi++yPNKUnv2mZet8+zySMTkTo7Z//fL/x90vQDNoAcQnwqPC6RrPX7NW5hKi1cBLLP+a5/65+8H0BB6APHRA5awJr/mLTyNif0BV618et/+8s8nzAuoB1A/PYD4+H4BUqUHUD89gPjoAaRKD6B+egDx0QNIlR5A/fQA4lPsAZu/ePydH/724SdfNe3G+zvd93e6btR/Y/MXjx9+8lW1N/QAAtIDiI/9AaRKD6B+egDx0QNIlR5A/fQA4qMHkCo9gPrpAcRHDyBVegD10wOIz2AwePXq1UtIzqtXr/QAaqYHEKUBJCr0e4vG+W9o/Z2fkHKowgAAAABJRU5ErkJggg==" alt="" width="635" height="299" />
工厂类的目的是为了产生Sender对象,通过不同的参数传入产生不同的对象。
将工厂类中的工厂方法改为多个工厂方法即为多个工厂方法的设计模式
将工厂类中的工场方法改为static即为静态工厂方法设计模式
二、抽象工厂方法模式:接口-实现类、接口-工厂类
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABJ8AAAHgCAIAAACEo1uVAAAgAElEQVR4nO3d728c54En+PkrDRz45vLmgMG8uDVwGEE4wLgAwbyZeTH0jgJkuTcbwHO7uY4mAx1sZOSsVoiwzso2YwYatRK3YlJJKxTFFUWzY9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m2l3cXgSquEPdiIPVjj2X0BDaTdtcCMZ2YucWyUvnPvdTrd0ek9xQ+kK8ZGZVdlpGcE5U4ZGp9swthosLOaH6BM+BWln3yP/oryF1aPjebzh4T/ybd2F4MZVhB7MHuwRrP7AhpIu2uB+ZyZOTpbaWd1bTT0WbnSeU2ZHxVk3teHH9mWXmhRmElm5mXv/f3+jc7manHmpb86q7s5fkOF8l8x4bym7MTFF5b9U8z7Dwn/qhXtLgYzrCD2YPZgjWb3BTSQdtcC87qrSu7eZeefB/evek+CzNk4FfckGF2CXzr92JOXzXyv05l0ltHwU+oJ5zVlThzKDAcnLM/4PQkKNxIo3IHg8nsSzPaHBH/HOe0uBjOsIPZg9mCNZvcFNJB21wLzOjMzNtmRTVsHFqF/W5R2F4MZVhB7MHuwRrP7AhpIu2sB7e6acp98t/TfofyyomBodzGYYQUJc7Wflj1Y49l9AQ2k3bXAUr7NHGqg3cWg7rUMFsXuC2gg7a4FtDtCpd3FoO61DBbF7gtoIO2uBbQ7QqXdxaDutQwWxe4LaCDtrgW0O0Kl3cWg7rUMFsXuC2gg7a4FtDtCpd3FoO61DBbF7gtoIO2uBY6Pjw8hREdHR4ZHwat7LYNFsfsCGki7a4EzCFrdWxgLVPfKBYtV9xYGME67AwAACIF2BwAAEIL/H/3nEeou49aBAAAAAElFTkSuQmCC" alt="" />
特点是:
工厂类实现某个接口,利于以后扩展,比如可以增加BlueTooth的工厂类。
工厂设计模式是抽象工厂设计模式的一个特例。
三、单例模式
单例对象(Singleton),保证在一个JVM中,该对象只有一个实例存在。
饿汉模式:类加载的时候就会创建,加载类时比较慢,但运行时获取对象的速度比较快,线程安全
/*
* 类型:饿汉模式
*/
public class Singleton {
//1.将构造方法私有化,不允许外部直接创建对象
private Singleton(){
} //2.创建类的唯一实例,使用private static修饰
private static Singleton instance=new Singleton(); //3.提供一个用于获取实例的方法,使用public static修饰
public static Singleton getInstance(){
return instance;
}
}
懒汉模式:类加载的时候不去创建,加载类时比较快,第一个用户获取时再去创建实例,第一次获取对象的速度比较慢,线程不安全
/*
* 懒汉模式
*/
public class Singleton2 {
//1.将构造方式私有化,不允许外边直接创建对象
private Singleton2(){
} //2.声明类的唯一实例,使用private static修饰
private static Singleton2 instance; //3.提供一个用于获取实例的方法,使用public static修饰
public static Singleton2 getInstance(){
if(instance==null){
instance=new Singleton2();
}
return instance;
}
}
四、建造者模式
参考:
http://www.cnblogs.com/BeyondAnyTime/archive/2012/07/19/2599980.html
http://www.cnblogs.com/devinzhang/archive/2012/01/06/2314670.html
1. builder:给出一个抽象接口,以规范产品对象的各个组成成分的建造。这个接口规定要实现复杂对象的哪些部分的创建,并不涉及具体的对象部件的创建。
2. ConcreteBuilder:实现Builder接口,针对不同的商业逻辑,具体化复杂对象的各部分的创建。 在建造过程完成后,提*品的实例。
3. Director:调用具体建造者来创建复杂对象的各个部分,在指导者中不涉及具体产品的信息,只负责保证对象各部分完整创建或按某种顺序创建。
4. Product:要创建的复杂对象。
public interface Product { } public interface Part { } //Builder接口
public interface Builder {
void buildPartA();
void buildPartB();
void buildPartC();
Product getResult();
} //具体建造类,不同的类对于不同的Part有不同的实现方法
public class ConcreteBuilder implements Builder {
Part partA, partB, partC; public void buildPartA() {
//这里是具体如何构建partA的代码
};
public void buildPartB() {
//这里是具体如何构建partB的代码
};
public void buildPartC() {
//这里是具体如何构建partB的代码
};
public Product getResult() {
//返回最后组装成品结果
};
} //建造者,产生最终的Product
public class Director {
private Builder builder;
public Director( Builder builder ) {
this.builder = builder;
}
public void construct() {
builder.buildPartA();
builder.buildPartB();
builder.buildPartC();
}
}
//测试代码:
ConcreteBuilder builder = new ConcreteBuilder();
Director director = new Director( builder );
director.construct();
Product product = builder.getResult();
五、原型模式
参考:http://blog.csdn.net/zhengzhb/article/details/7393528
原型模式的优点及适用场景
使用原型模式创建对象比直接new一个对象在性能上要好的多,因为Object类的clone方法是一个本地方法,它直接操作内存中的二进制流,特别是复制大对象时,性能的差别非常明显。
使用原型模式的另一个好处是简化对象的创建,使得创建对象就像我们在编辑文档时的复制粘贴一样简单。
因为以上优点,所以在需要重复地创建相似对象时可以考虑使用原型模式。比如需要在一个循环体内创建对象,假如对象创建过程比较复杂或者循环次数很多的话,使用原型模式不但可以简化创建过程,而且可以使系统的整体性能提高很多。
原型模式的注意事项
使用原型模式复制对象不会调用类的构造方法。因为对象的复制是通过调用Object类的clone方法来完成的,它直接在内存中复制数据,因此不会调用到类的构造方法。不但构造方法中的代码不会执行,甚至连访问权限都对原型模式无效。还记得单例模式吗?单例模式中,只要将构造方法的访问权限设置为private型,就可以实现单例。但是clone方法直接无视构造方法的权限,所以,单例模式与原型模式是冲突的,在使用时要特别注意。
深拷贝与浅拷贝。Object类的clone方法只会拷贝对象中的基本的数据类型,对于数组、容器对象、引用对象等都不会拷贝,这就是浅拷贝。如果要实现深拷贝,必须将原型模式中的数组、容器对象、引用对象等另行拷贝。
PS:深拷贝与浅拷贝问题中,会发生深拷贝的有java中的8中基本类型以及他们的封装类型,另外还有String类型(String是final的无法修改,修改即创建新对象),其余的都是浅拷贝。