Skip to content

Instantly share code, notes, and snippets.

@panlw
Last active January 21, 2020 14:31
Show Gist options
  • Save panlw/b27cbda58c92bbac494e56093798be00 to your computer and use it in GitHub Desktop.
Save panlw/b27cbda58c92bbac494e56093798be00 to your computer and use it in GitHub Desktop.
Deserialize immutable lombok annotated objects with jackson
// https://www.baeldung.com/jackson-deserialize-immutable-objects
// https://stackoverflow.com/questions/49999492/immutable-lombok-annotated-class-with-jackson/50030088
@Builder(builderClassName = "ValueObjectBuilder")
@JsonDeserialize(builder = ValueObject.ValueObjectBuilder.class)
@Value
@EqualsAndHashCode(of = {...})
public class ValueObject {
@JsonPOJOBuilder(withPrefix = "")
@JsonIgnoreProperties(ignoreUnknown = true)
public static class ValueObjectBuilder {
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment