Value Objects in Java with AutoValue and Lombok
In this post I want to discuss the subject of Value Objects, their purpose and some ways of easily implementing them in Java, specifically, although not exclusively, within the context of Android development. I’ll cover a couple of popular libraries that I’ve tried, namely Project Lombok and AutoValue, how they approach the problem of making value objects easier to create and maintain, plus a few pitfalls. In computer science, a value object is a small object that represents a simple entity whose equality is not based on identity: i.e. two value objects are equal when they have the same value, not necessarily being the same object. Examples of value objects are objects representing an amount of money or a date range. ...