Hi,
I started reading Holub's pattern book and not sure if this is a mistake (pg 59-61).
He has in listing 2-3
public interface Employee
{ void youAreFired();
}
public static class EmployeeFactory
{ private Factory() {}
public static Employee create()
{ return new Peon();
}
}
/* package*/ class Peon implements Employee
{ public void youAreFired()
{ //lots of code
}
}
He is using Employee.Factory.create()
. Factory is not a inner class of Employee, so how is using that?
Then two pages down he says Employee.Factory
is a singleton. How? I think its a typo, Factory
or Employee.Factory
should actually be EmployeeFactory
. I hope I am not missing something major in Java programming!