diff --git a/AUTHORS b/AUTHORS
index e6ecbfd0..822c1161 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,6 +24,7 @@ Rabea Gransberger
+ You can customize parts of your builder, for example adding another method to the builder class, or annotating a method in the builder class, by making the builder class yourself. Lombok will generate everything that you do not manually add, and put it into this builder class. For example, if you are trying to configure jackson to use a specific subtype for a collection, you can write something like:
+@Value @Builder
+@JsonDeserialize(builder = JacksonExample.JacksonExampleBuilder.class)
+public class JacksonExample {
+ @Singular private List<Foo> foos;
+
+ @JsonPOJOBuilder(withPrefix = "")
+ public static class JacksonExampleBuilder implements JacksonExampleBuilderMeta {
+ }
+
+ private interface JacksonExampleBuilderMeta {
+ @JsonDeserialize(contentAs = FooImpl.class) JacksonExampleBuilder foos(List<? extends Foo> foos)
+ }
+}
+@FieldNameConstants was introduced as experimental feature in lombok v1.16.22. +
+ @FieldNameConstants was redesigned in lombok v1.18.4.
@f.history> @@ -18,11 +20,11 @@ <@f.overview>
- The @FieldNameConstants annotation generates string constants (fields marked public static final, of type java.lang.String) containing the field's name, as a string. This is useful for various marshalling and serialization frameworks. The constant field by default is named FIELD_NAME_OF_FIELD, where NAME_OF_FIELD is the same name as the field it represents, except with all uppercase letters, with underscores in front of the uppercase letters in the original field. The prefix (and suffix) is configurable on the @FieldNameConstants annotation.
+ The @FieldNameConstants annotation generates an inner type which contains 1 constant for each field in your class; either string constants (fields marked public static final, of type java.lang.String) or if you prefer, an enum type with 1 value for each field. @FieldNameConstants is useful for various marshalling and serialization frameworks. The constant field (whether enum value or string constant) always has the exact same name as the field, capitalization and all.
- The public access modifier can be changed via the parameter level = AccessLevel.PACKAGE for example. You can force a field to be skipped by supplying level = AccessLevel.NONE.
+ The generated inner type is by default called Fields and is public. You can modify this via @FieldNameConstants(innerTypeName = "FieldNames", access = AccessLevel.PACKAGE) for example. The default inner type name can also be modified via configuration key lombok.fieldNameConstants.innerTypeName. The generated fields are always public.
- Can be applied to classes (in which case every field gets a constant), or to an individual field.
+ Must be applied to classes (or enums, though you'd rarely want to do that). By default includes all non-transient, non-static fields. You can use @FieldNameConstants.Include in fields + @FieldNameConstants(onlyExplicitlyIncluded = true), or @FieldNameConstants.Exclude for more fine-grained control.
@FieldDefaults as a warning or error if configured.
lombok.fieldNameConstants.prefix = a string (default: 'PREFIX_')
+ lombok.fieldNameConstants.innerTypeName = a string (default: 'Fields')
lombok.fieldNameConstants.suffix = a string (default: '' - the blank string)
-
- Like other lombok handlers that touch fields, any field whose name starts with a dollar ($) symbol is skipped entirely. Such a field will not be modified at all. Static fields are also skipped.
+ From lombok v1.16.22 to lombok v1.18.2, this feature generated constants inside the type directly; the name of these fields would for example turn field exampleFieldName into public static final String FIELD_EXAMPLE_FIELD_NAME = "exampleFieldName";. The prefix and suffix (here, FIELD_, and the empty string) were configurable. Starting with lombok v1.18.4 this feature has been redesigned into generating an inner type as described above.
- The annotation can itself be used to set prefix/suffix. If you do so, it overrides the lombok.fieldNameConstants.prefix/suffix config key. Example: @FieldNameConstants(prefix = ""): This would generate for field helloWorld a constant named HELLO_WORLD instead of the default FIELD_HELLO_WORLD.
+ Any parameters of lombok annotations that take strings need to be supplied actual string literals; you cannot have references to constants like those generated by @FieldNameConstants. If you'd like to use @FieldNameConstants to for example fill in the of and/or exclude parameters of @ToString and similar lombok annotations, use the @ToString.Include / @ToString.Exclude etc system instead; these are described at the feature pages for those features.
+
+ Like other lombok handlers that touch fields, any field whose name starts with a dollar ($) symbol is skipped entirely. Such a field will not be modified at all. Static fields are also skipped.
Note, to tell the gradle-lombok plugin to use the latest version of lombok, you need to explicitly tell it about the latest version number and the SHA-256. For our current latest version, put this in your build.gradle file:
lombok {
- version = ${version}
+ version = '${version}'
sha256 = ""
}
diff --git a/website/usageExamples/LogExample_post.jpage b/website/usageExamples/LogExample_post.jpage
index eab3b046..78c0fdd9 100644
--- a/website/usageExamples/LogExample_post.jpage
+++ b/website/usageExamples/LogExample_post.jpage
@@ -2,7 +2,7 @@ public class LogExample {
private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LogExample.class.getName());
public static void main(String... args) {
- log.error("Something's wrong here");
+ log.severe("Something's wrong here");
}
}
diff --git a/website/usageExamples/LogExample_pre.jpage b/website/usageExamples/LogExample_pre.jpage
index ba27dd27..9fa1e91c 100644
--- a/website/usageExamples/LogExample_pre.jpage
+++ b/website/usageExamples/LogExample_pre.jpage
@@ -5,7 +5,7 @@ import lombok.extern.slf4j.Slf4j;
public class LogExample {
public static void main(String... args) {
- log.error("Something's wrong here");
+ log.severe("Something's wrong here");
}
}