@Target(value={TYPE,METHOD,CONSTRUCTOR}) @Retention(value=SOURCE) public @interface Jacksonized
@Jacksonized
annotation is an add-on annotation for
@
Builder
, @
SuperBuilder
, and
@
Accessors
.
For @
Accessors
(fluent = true)
on a type, it automatically
configures Jackson to use the generated setters and getters for
(de-)serialization by inserting @
JsonProperty
annotations.
(Note that @Jacksonized
@Accessors
on fields are not supported.)
For @
Builder
and @
SuperBuilder
, it
automatically configures the generated builder class to be used by Jackson's
deserialization. It only has an effect if present at a context where there is
also a @Builder
or a @SuperBuilder
; a warning is emitted
otherwise.
In particular, the annotation does the following:
@JsonDeserialize(builder=Foobar.FoobarBuilder[Impl].class)
on the
class (where Foobar is the name of the annotated class).@JsonIgnoreProperties
) from the class to the builder class. This is
necessary so that Jackson recognizes them when using the builder.@JsonPOJOBuilder(withPrefix="")
on the generated builder
class to override Jackson's default prefix "with". If you configured a
different prefix in lombok using setterPrefix
, this value is used. If
you changed the name of the build()
method using
buildMethodName
, this is also made known to Jackson.@SuperBuilder
, make the builder implementation class
package-private.@Jacksonized
@SuperBuilder
remains fully
compatible to regular @SuperBuilder
s.Copyright © 2025. All rights reserved.