You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often times when developing against a data model that may change (whether third party API or your own application models) where backwards compatibility is needed it would be nice to use the builder pattern to support multiple properties that map to the same internal field.
@JsonDeserialize( builder = MyClass.MyClassBuilder.class )
publicclassMyClass {
privatefinalStringpropertyA;
MyClass( StringpropertyA ) {
this.propertyA = propertyA;
this.propertyB = propertyB;
}
// The updated class and eventStatus represents the most current version of the// data model@JsonProperty( "eventStatus" )
publicgetPropertyA() {
returnthis.propertyA;
}
@JsonPojoBuilderpublicstaticclassMyClassBuilder {
StringeventStatus = "Success";
@JsonProperty( { "eventCode", "eventStatus" } )
publicMyClassBuilderwithEventStatus( StringeventStatus ) {
this.eventStatus = eventStatus;
returnthis;
}
}
}
The text was updated successfully, but these errors were encountered:
Often times when developing against a data model that may change (whether third party API or your own application models) where backwards compatibility is needed it would be nice to use the builder pattern to support multiple properties that map to the same internal field.
The text was updated successfully, but these errors were encountered: