aboutsummaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-06-04 23:34:25 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-06-04 23:36:10 +0200
commitb8e85f5dc7044e9a4bd43c41786bdda2a38f50ac (patch)
tree7b93ae4844e9d9cd64f3f8dcfd9a72f2407921d5 /website
parentfb5a5530148614e8d0c423077d9043e2d58f453b (diff)
downloadlombok-b8e85f5dc7044e9a4bd43c41786bdda2a38f50ac.tar.gz
lombok-b8e85f5dc7044e9a4bd43c41786bdda2a38f50ac.tar.bz2
lombok-b8e85f5dc7044e9a4bd43c41786bdda2a38f50ac.zip
FieldNameConstants now defaults to having a prefix ‘FIELD_’, which can be configured both on the annotation itself and via a config key. This totally breaks compatibility with the previous lombok release, but, hey, it’s in experimental and it’s been one week. This is better.
Diffstat (limited to 'website')
-rw-r--r--website/templates/features/experimental/FieldNameConstants.html14
1 files changed, 12 insertions, 2 deletions
diff --git a/website/templates/features/experimental/FieldNameConstants.html b/website/templates/features/experimental/FieldNameConstants.html
index 05c57f84..c5e57195 100644
--- a/website/templates/features/experimental/FieldNameConstants.html
+++ b/website/templates/features/experimental/FieldNameConstants.html
@@ -3,7 +3,7 @@
<@f.scaffold title="@FieldNameConstants" logline="Name... that... field! String constants for your field's names.">
<@f.history>
<p>
- @FieldNameConstants was introduced as experimental feature in lombok v2.0.0.
+ @FieldNameConstants was introduced as experimental feature in lombok v1.16.22.
</p>
</@f.history>
@@ -18,7 +18,7 @@
<@f.overview>
<p>
- The <code>@FieldNameConstants</code> annotation generates string constants (fields marked <code>public static final</code>, of type <code>java.lang.String</code>) containing the field's name, as a string. This is useful for various marshalling and serialization frameworks. The constant field has the same as the field it represents, except with all uppercase letters, with underscores in front of the uppercase letters in the original field. If this results in the exact same name, the constant is not generated (a warning is generated instead).
+ The <code>@FieldNameConstants</code> annotation generates string constants (fields marked <code>public static final</code>, of type <code>java.lang.String</code>) containing the field's name, as a string. This is useful for various marshalling and serialization frameworks. The constant field by default is named <code>FIELD_<em>NAME_OF_FIELD</em></code>, where <em>NAME_OF_FIELD</em> 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 <code>@FieldNameConstants</code> annotation.
</p><p>
The <code>public</code> access modifier can be changed via the parameter <code>level = AccessLevel.PACKAGE</code> for example. You can force a field to be skipped by supplying <code>level = AccessLevel.NONE</code>.
</p><p>
@@ -33,12 +33,22 @@
<code>lombok.fieldNameConstants.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Lombok will flag any usage of <code>@FieldDefaults</code> as a warning or error if configured.
+ </dd><dt>
+ <code>lombok.fieldNameConstants.prefix</code> = <em>a string</em> (default: 'PREFIX_')
+ </dt><dd>
+ Lombok will generate the name for each fieldconstant by constant-casing the field name and then prefixing this string to the result.
+ </dd><dt>
+ <code>lombok.fieldNameConstants.suffix</code> = <em>a string</em> (default: '' - the blank string)
+ </dt><dd>
+ Lombok will generate the name for each fieldconstant by constant-casing the field name and then suffixing this string to the result.
</dd>
</@f.confKeys>
<@f.smallPrint>
<p>
Like other lombok handlers that touch fields, any field whose name starts with a dollar (<code>$</code>) symbol is skipped entirely. Such a field will not be modified at all. Static fields are also skipped.
+ </p><p>
+ The annotation can itself be used to set prefix/suffix. If you do so, it overrides the <code>lombok.fieldNameConstants.prefix/suffix</code> config key. Example: <code>@FieldNameConstants(prefix = "")</code>: This would generate for field <code>helloWorld</code> a constant named <code>HELLO_WORLD</code> instead of the default <code>FIELD_HELLO_WORLD</code>.
</p>
</@f.smallPrint>
</@f.scaffold>