Refactoring Guru provides a good example for factory method.
In that example there are Common product interface, Concrete products, Base creator and Concrete creator. But in Calendar, I find only Common product interface (Calendar class) and Concrete products ( GregorianCalendar, JapaneseImperialCalendar etc. which extends Calendar).
We call Calendar.getInstance()
and we get instance of Calendar
. My expectation was that we call a concrete creator and get an instance of concrete product.
How is Calendar
an example for factory method?
Aucun commentaire:
Enregistrer un commentaire