Last active
November 3, 2021 22:54
-
-
Save kapresoft/115d9cbcd185a328613ff92b0b7e5bdd to your computer and use it in GitHub Desktop.
Immutable Account without 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.simple; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | |
import lombok.*; | |
import lombok.experimental.FieldDefaults; | |
@Getter | |
@ToString | |
@EqualsAndHashCode | |
@FieldDefaults(makeFinal=true, level= AccessLevel.PRIVATE) | |
@JsonPropertyOrder({"username", "email", "firstName", "lastName"}) | |
public class AccountWithoutUsingValue { | |
String username; | |
String email; | |
String firstName; | |
String lastName; | |
@Builder | |
public AccountWithoutUsingValue(@JsonProperty("username") String username, | |
@JsonProperty("email") String email, | |
@JsonProperty("firstName") String firstName, | |
@JsonProperty("lastName") String lastName) { | |
this.username = username; | |
this.email = 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