Skip to content

Commit 5d44152

Browse files
committed
docs: update value object
1 parent 723b1bf commit 5d44152

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

value-object/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
5353
class HeroStat {
54-
5554
int strength;
5655
int intelligence;
5756
int luck;
@@ -61,16 +60,18 @@ class HeroStat {
6160
The 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

7677
Here'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

Comments
 (0)