Factory(Simple Factory)
来源:互联网 发布:唐嫣身材知乎 编辑:程序博客网 时间:2024/05/21 18:49
Simple Factory:
package com.sean.factory.simple;
public interface IPerson {
public String getName();
}
/**
*
*/
package com.sean.factory.simple;
import com.sean.factory.Names;
/**
* @author Sean_Zhang
*
*/
public class Man implements IPerson {
/* (non-Javadoc)
* @see com.sean.factory.simple.IPerson#getName()
*/
public String getName() {
return Names.MAN.getName();
}
}
/**
*
*/
package com.sean.factory.simple;
import com.sean.factory.Names;
/**
* @author Sean_Zhang
*
*/
public class Woman implements IPerson {
/* (non-Javadoc)
* @see com.sean.factory.simple.IPerson#getName()
*/
public String getName() {
return Names.WOMAN.getName();
}
}
/**
*
*/
package com.sean.factory.simple;
import com.sean.factory.Sex;
/**
* @author Sean_Zhang
*
*/
public class PersonSimpleFactory {
public static IPerson getPerson(Sex sex) {
IPerson person = null;
if(sex == Sex.MALE) {
person = new Man();
} else if(sex == Sex.FEMALE) {
person = new Woman();
}
return person;
}
}
- Factory(Simple Factory)
- simple factory
- Simple Factory
- Simple Factory
- simple factory
- simple factory
- Simple Factory Pattern
- [Simple Factory]:Source Sample
- Simple Factory Pattern
- Simple Factory设计模式
- 设计模式--Simple Factory
- Simple factory pattern
- Simple Factory Design
- DesignPattern-Simple Factory
- Simple Factory 模式
- simple factory(简单工厂)
- Simple Factory 模式
- Design Pattern :Simple Factory
- Backbone入门(View,Controller)
- 浅谈VB6中的自定义类的使用
- PGSQL常用命令与个人实践
- ubuntu安装瑞捷客户端mentohust(简易安装)
- Eclipse中看java源代码
- Factory(Simple Factory)
- ubuntu+eclipse 配置 GTK
- silverlight 各种常用应用
- 第六章 继承和面向对象设计 (Effective C++ Second Edition 读书笔记)
- Run task when app enter background.
- EL表达式调用函数
- Creating Custom ASP.NET Server Controls with Embedded JavaScript
- 嵌入式的学习
- 基于移动平台的多媒体框架——ffmpeg对流媒体的支持