View Source on Github

Value Object

Difficulty-Beginner Java Creational


Provide objects which follow value semantics rather than reference semantics. This means value objects' equality are not based on identity. Two value objects are equal when they have the same value, not necessarily being the same object.

alt text


Use the Value Object when

  • you need to measure the objects' equality based on the objects' value

Real world examples