mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-03 07:13:02 +00:00
Commented prototype example.
This commit is contained in:
1 parent
2038d69d92
commit
ed81bcf69b
3 files changed
+17
No files matched your search
@@ -1,5 +1,12 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* In Prototype we have a factory class (HeroFactoryImpl) producing
|
||||
* objects by cloning existing ones. In this example the factory's
|
||||
* prototype objects are given as constructor parameters.
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for the factory class.
|
||||
*
|
||||
*/
|
||||
public interface HeroFactory {
|
||||
|
||||
Mage createMage();
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Concrete factory class.
|
||||
*
|
||||
*/
|
||||
public class HeroFactoryImpl implements HeroFactory {
|
||||
|
||||
private Mage mage;
|
||||
|
||||
Reference in new issue
Block a user