ITPub博客

首页 > IT职业 > IT生活 > 我工作的那点事--学习《设计模式》实例应用(factory模式)

我工作的那点事--学习《设计模式》实例应用(factory模式)

原创 IT生活 作者:biqing0427 时间:2007-11-20 22:49:23 0 删除 编辑

[@more@]最近公司效率不好,不断地裁员,自己也感到有压力,要为以后做准备了,开始慢慢找工作了,于是准备简历了。

1.Person 个人信息类:

public class Person{

private String name;
private String sex;
private int workTime;
private String companyName;
private String address;
private String proxExperience;
………………

public Person(){
}

public void setName(String name){
this.name = name;
}

public String getName(){
return name;
}

public void setSex(String sex){
this.sex = sex;
}

public String getSex(){
return sex;
}

public void setWorkTime(int workTime){
this.workTime = workTime;
}

public int getWorkTime(){
return workTime;
}

public void setCompanyName(String companyName){
this.companyName= companyName;
}

public String getCompanyName(){
return companyName;
}

public void setAddress(String address){
this.address= address;
}

public String getAddress(){
return address;
}

public void setProxExperience(String proxExperience){
this.proxExperience= proxExperience;
}

public String getProxExperience(){
return proxExperience;
}
………………
}

2.简历写好了,下面要开始找公司 找职位了,现在有很多途径:招聘会、网站、朋友推荐,猎头等等……,
他们就像工厂一样,根据你的要求,自动生成单位和职位 给你,你不用参与找这些东东产生的过程,也不用你面对一堆单位,不知从哪里开始找。
2.1 QueryInfo 查询条件:
public class QueryInfo{

private String city;
private String companyType;
private String jobType;
………………

public QueryInfo(){
}

public void setCity(String city){
this.city = city;
}

public String getCity(){
return city;
}

public void setCompanyType(String companyType){
this.companyType= companyType;
}

public String getCompanyType(){
return companyType;
}

public void setJobType(String jobType){
this.jobType= jobType;
}

public String getJobType(){
return jobType;
}
………………
}

2.2 招聘网站:
CompanyFactory:

public class CompanyFactory{

private Company company = null;

public static Company createCompany(Person person, QueryInfo queryInfo){

if(queryInfo.jobType.equals("a")){
company = new CompanyA();
} else if(queryInfo.jobType.equals("b")){
company = new CompanyB();
} else if(queryInfo.jobType.equals("c")){
company = new CompanyC();
}
……………………
return company;
}

}

2.3 好的公司 和工作
public abstract class Company(){

public abstract void companyInfo();
public abstract void companyType();
public abstract void companyFund();
public abstract void companyJob();

}

public class CompanyA() extends Company{

public void companyInfo(){};
public void companyType(){};
public void companyFund(){};
public void companyJob(){};

}

public class CompanyB() extends Company{

public void companyInfo(){};
public void companyType(){};
public void companyFund(){};
public void companyJob(){};

}

public class CompanyC() extends Company{

public void companyInfo(){};
public void companyType(){};
public void companyFund(){};
public void companyJob(){};

}

3. 一切都准备好了,下面就根据自己的条件,找工作吧:

public void testFactory(){
Person person = new Person();
person.setName("name");
person.setSex("男");
…………

QueryInfo queryInfo = new QueryInfo();
queryInfo.setCompanyType("wolf");
…………

//要找的公司
Company company;

//投简历
company = CompanyFactory.createCompanyFactory(person,queryInfo);
}

4.给自己想进的公司投完简历,呵呵,下面就准备面试,得到自己想要的薪水,准备大干吧,呵呵

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9879276/viewspace-983084/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    24
  • 访问量
    11585