diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 04a81cd1..9f0e2242 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -1,13 +1,14 @@ Lombok Changelog ---------------- -### v.18.13 "Edgy Guinea Pig" +### v1.18.13 "Edgy Guinea Pig" * BREAKING CHANGE: mapstruct users should not add a dependency to lombok-mapstruct-binding. This solves compiling modules with lombok (and mapstruct). * FEATURE: Similar to `@Builder`, you can now configure a `@SuperBuilder`'s 'setter' prefixes via `@SuperBuilder(setterPrefix = "set")` for example. We still discourage doing this. [Pull Request #2357](https://github.com/rzwitserloot/lombok/pull/2357). * FEATURE: If using `@Synchronized("lockVar")`, if `lockVar` is referring to a static field, the code lombok generates no longer causes a warning about accessing a static entity incorrectly. [Issue #678](https://github.com/rzwitserloot/lombok/issues/678) * BUGFIX: Using `@SuperBuilder` on a class that has some fairly convoluted generics usage would fail with 'Wrong number of type arguments'. [Issue #2359](https://github.com/rzwitserloot/lombok/issues/2359) [Pull Request #2362](https://github.com/rzwitserloot/lombok/pull/2362) * BUGFIX: Various lombok annotations on classes nested inside enums or interfaces would cause errors in eclipse. [Issue #2369](https://github.com/rzwitserloot/lombok/issues/2369) * BUGFIX: Trying to add `@ExtensionMethod`s with exactly 2 arguments would fail in eclipse. [Issue #1441](https://github.com/rzwitserloot/lombok/issues/1441) [Pull Request #2376](https://github.com/rzwitserloot/lombok/pull/2376) thanks to __@Rawi01__. +* FEATURE: `@Jacksonized` on a `@Builder` or `@SuperBuilder` will configure [Jackson](https://github.com/FasterXML/jackson) to use this builder when deserializing. [Pull Request #2387](https://github.com/rzwitserloot/lombok/pull/2387). [@Jacksonized documentation](https://projectlombok.org/features/experimental/Jacksonized). ### v1.18.12 (February 1st, 2020) * PLATFORM: Support for JDK13 (including `yield` in switch expressions, as well as delombok having a nicer style for arrow-style switch blocks, and text blocks). diff --git a/website/templates/features/experimental/Jacksonized.html b/website/templates/features/experimental/Jacksonized.html new file mode 100644 index 00000000..fd2bfe68 --- /dev/null +++ b/website/templates/features/experimental/Jacksonized.html @@ -0,0 +1,53 @@ +<#import "../_features.html" as f> + +<@f.scaffold title="@Jacksonized" logline="Make Jackson use your builders."> + <@f.history> +
+ @Jacksonized was introduced as experimental feature in lombok v1.18.14.
+
+ The @Jacksonized annotation is an add-on annotation 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.
+
+ Without @Jacksonized, you would have to customize your builder class(es).
+ With @Jacksonized, you can simply write something like this to let Jackson use the generated builder:
+@Jacksonized @Builder
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class JacksonExample {
+ private List<Foo> foos;
+}
+
+ This annotation is especially useful when deserializing into immutable (sub-)classes that only use @SuperBuilder to create instances.
+ With @Jacksonized, you do not have to put the complex @SuperBuilder class header into your code just to configure it for Jackson.
+
+ This annotation does not change the behavior of the generated builder.
+ A @Jacksonized @SuperBuilder remains fully compatible to regular @SuperBuilders.
+
+ 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).
+ (An error is emitted if such an annotation already exists.)
+ @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 using buildMethodName, this is also made known to Jackson.
+ @SuperBuilder, make the builder implementation class package-private.
+