@@ -51,7 +51,6 @@ Here is the `HeroStat` class that is the value object. Notice the use of [Lombok
5151@Value (staticConstructor = " valueOf" )
5252@ToString
5353class HeroStat {
54-
5554 int strength;
5655 int intelligence;
5756 int luck;
@@ -61,16 +60,18 @@ class HeroStat {
6160The example creates three different ` HeroStat ` s and compares their equality.
6261
6362``` java
64- var statA = HeroStat . valueOf(10 , 5 , 0 );
65- var statB = HeroStat . valueOf(10 , 5 , 0 );
66- var statC = HeroStat . valueOf(5 , 1 , 8 );
63+ public static void main(String [] args) {
64+ var statA = HeroStat . valueOf(10 , 5 , 0 );
65+ var statB = HeroStat . valueOf(10 , 5 , 0 );
66+ var statC = HeroStat . valueOf(5 , 1 , 8 );
6767
68- LOGGER . info(" statA: {}" , statA);
69- LOGGER . info(" statB: {}" , statB);
70- LOGGER . info(" statC: {}" , statC);
68+ LOGGER . info(" statA: {}" , statA);
69+ LOGGER . info(" statB: {}" , statB);
70+ LOGGER . info(" statC: {}" , statC);
7171
72- LOGGER . info(" Are statA and statB equal? {}" , statA. equals(statB));
73- LOGGER . info(" Are statA and statC equal? {}" , statA. equals(statC));
72+ LOGGER . info(" Are statA and statB equal? {}" , statA. equals(statB));
73+ LOGGER . info(" Are statA and statC equal? {}" , statA. equals(statC));
74+ }
7475```
7576
7677Here's the console output.
@@ -137,4 +138,4 @@ Trade-offs:
137138* [ Effective Java] ( https://amzn.to/4cGk2Jz )
138139* [ J2EE Design Patterns] ( https://amzn.to/4dpzgmx )
139140* [ Patterns of Enterprise Application Architecture] ( https://amzn.to/3WfKBPR )
140- * [ ValueObject - Martin Fowler] ( https://martinfowler.com/bliki/ValueObject.html )
141+ * [ ValueObject ( Martin Fowler) ] ( https://martinfowler.com/bliki/ValueObject.html )
0 commit comments