Created
October 24, 2024 10:00
-
-
Save karthiks/5f654524046cfe78facb8722d6c3ce5a to your computer and use it in GitHub Desktop.
Person and Address class with equal() and hashCode() generated using Lombok utility library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.Data; | |
@Data // Generates getters for all fields, a useful toString method, and hashCode and equals implementations that checkall non-transient fields. Will also generate setters for all non-final fields, as well as a constructor. | |
// @Data = @Getter + @Setter + @RequiredArgsConstructor + @ToString + @EqualsAndHashCode | |
public class Person { | |
private Long id; | |
private String name; | |
} | |
@Data | |
class Address { | |
private String road; | |
private String city; | |
private String pincode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment