Java 11 migration: ambassador async-method-invocation balking bridge builder (#1076)
* Moves ambassador pattern to java 11 * Moves async-method-invocation pattern to java 11 * Moves balking pattern to java 11 * Moves bridge pattern to java 11 * Moves builder pattern to java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
f0f0143d48
commit
c4418311c6
@@ -59,20 +59,22 @@ public class App {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
Hero mage =
|
||||
new Hero.Builder(Profession.MAGE, "Riobard").withHairColor(HairColor.BLACK)
|
||||
.withWeapon(Weapon.DAGGER).build();
|
||||
var mage = new Hero.Builder(Profession.MAGE, "Riobard")
|
||||
.withHairColor(HairColor.BLACK)
|
||||
.withWeapon(Weapon.DAGGER)
|
||||
.build();
|
||||
LOGGER.info(mage.toString());
|
||||
|
||||
Hero warrior =
|
||||
new Hero.Builder(Profession.WARRIOR, "Amberjill").withHairColor(HairColor.BLOND)
|
||||
.withHairType(HairType.LONG_CURLY).withArmor(Armor.CHAIN_MAIL).withWeapon(Weapon.SWORD)
|
||||
.build();
|
||||
var warrior = new Hero.Builder(Profession.WARRIOR, "Amberjill")
|
||||
.withHairColor(HairColor.BLOND)
|
||||
.withHairType(HairType.LONG_CURLY).withArmor(Armor.CHAIN_MAIL).withWeapon(Weapon.SWORD)
|
||||
.build();
|
||||
LOGGER.info(warrior.toString());
|
||||
|
||||
Hero thief =
|
||||
new Hero.Builder(Profession.THIEF, "Desmond").withHairType(HairType.BALD)
|
||||
.withWeapon(Weapon.BOW).build();
|
||||
var thief = new Hero.Builder(Profession.THIEF, "Desmond")
|
||||
.withHairType(HairType.BALD)
|
||||
.withWeapon(Weapon.BOW)
|
||||
.build();
|
||||
LOGGER.info(thief.toString());
|
||||
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public enum Armor {
|
||||
|
||||
CLOTHES("clothes"), LEATHER("leather"), CHAIN_MAIL("chain mail"), PLATE_MAIL("plate mail");
|
||||
|
||||
private String title;
|
||||
private final String title;
|
||||
|
||||
Armor(String title) {
|
||||
this.title = title;
|
||||
|
@@ -31,7 +31,7 @@ public enum HairType {
|
||||
BALD("bald"), SHORT("short"), CURLY("curly"), LONG_STRAIGHT("long straight"), LONG_CURLY(
|
||||
"long curly");
|
||||
|
||||
private String title;
|
||||
private final String title;
|
||||
|
||||
HairType(String title) {
|
||||
this.title = title;
|
||||
|
@@ -71,7 +71,7 @@ public final class Hero {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
sb.append("This is a ")
|
||||
.append(profession)
|
||||
.append(" named ")
|
||||
|
Reference in New Issue
Block a user