Last active
November 3, 2021 22:50
-
-
Save kapresoft/025aeb9930e6356baf119b03caa7edc9 to your computer and use it in GitHub Desktop.
Immutable HierarchicalAccount using Lombok `@Value` Annotation
This file contains hidden or 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
package com.kapresoft.springboot.serializeimmutableobjects.dto.hierarchical; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | |
import lombok.Builder; | |
import lombok.EqualsAndHashCode; | |
import lombok.Value; | |
@Value | |
@EqualsAndHashCode(callSuper = true) | |
@JsonPropertyOrder({"username", "email", "firstName", "lastName"}) | |
public class HierarchicalAccount extends BaseAccount { | |
String firstName; | |
String lastName; | |
@Builder | |
HierarchicalAccount(@JsonProperty("username") String username, | |
@JsonProperty("email") String email, | |
@JsonProperty("firstName") String firstName, | |
@JsonProperty("lastName") String lastName) { | |
super(username, email); | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment