#107 JavaDoc improvements for Abstract Factory example
This commit is contained in:
parent
0d2df99013
commit
fd85a2f848
@ -3,20 +3,28 @@ package com.iluwatar.abstractfactory;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The essence of the Abstract Factory pattern is a factory interface
|
* The essence of the Abstract Factory pattern is a factory interface
|
||||||
* (KingdomFactory) and its implementations (ElfKingdomFactory,
|
* ({@link KingdomFactory}) and its implementations ({@link ElfKingdomFactory},
|
||||||
* OrcKingdomFactory).
|
* {@link OrcKingdomFactory}).
|
||||||
*
|
* <p>
|
||||||
* The example uses both concrete implementations to create a king, a castle and
|
* The example uses both concrete implementations to create a king, a castle and
|
||||||
* an army.
|
* an army.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Program entry point
|
||||||
|
* @param args command line arguments
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
createKingdom(new ElfKingdomFactory());
|
createKingdom(new ElfKingdomFactory());
|
||||||
createKingdom(new OrcKingdomFactory());
|
createKingdom(new OrcKingdomFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates kingdom
|
||||||
|
* @param factory
|
||||||
|
*/
|
||||||
public static void createKingdom(KingdomFactory factory) {
|
public static void createKingdom(KingdomFactory factory) {
|
||||||
King king = factory.createKing();
|
King king = factory.createKing();
|
||||||
Castle castle = factory.createCastle();
|
Castle castle = factory.createCastle();
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Army interface
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Army {
|
public interface Army {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Castle interface
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Castle {
|
public interface Castle {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ElfArmy
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ElfArmy implements Army {
|
public class ElfArmy implements Army {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ElfCastle
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ElfCastle implements Castle {
|
public class ElfCastle implements Castle {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ElfKing
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ElfKing implements King {
|
public class ElfKing implements King {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar.abstractfactory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Concrete factory.
|
* ElfKingdomFactory concrete factory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ElfKingdomFactory implements KingdomFactory {
|
public class ElfKingdomFactory implements KingdomFactory {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* King interface
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface King {
|
public interface King {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar.abstractfactory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The factory interface.
|
* KingdomFactory factory interface.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface KingdomFactory {
|
public interface KingdomFactory {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrcArmy
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcArmy implements Army {
|
public class OrcArmy implements Army {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrcCastle
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcCastle implements Castle {
|
public class OrcCastle implements Castle {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.abstractfactory;
|
package com.iluwatar.abstractfactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrcKing
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcKing implements King {
|
public class OrcKing implements King {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar.abstractfactory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Concrete factory.
|
* OrcKingdomFactory concrete factory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OrcKingdomFactory implements KingdomFactory {
|
public class OrcKingdomFactory implements KingdomFactory {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user