mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-25 03:36:33 +00:00
docs: update abstract factory
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package com.iluwatar.abstractfactory;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@@ -41,14 +42,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* both concrete implementations to create a king, a castle, and an army.
|
||||
*/
|
||||
@Slf4j
|
||||
@Getter
|
||||
public class App implements Runnable {
|
||||
|
||||
private final Kingdom kingdom = new Kingdom();
|
||||
|
||||
public Kingdom getKingdom() {
|
||||
return kingdom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*
|
||||
|
||||
@@ -57,7 +57,6 @@ public class Kingdom {
|
||||
return switch (type) {
|
||||
case ELF -> new ElfKingdomFactory();
|
||||
case ORC -> new OrcKingdomFactory();
|
||||
default -> throw new IllegalArgumentException("KingdomType not supported.");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user