From bf0499263b05e11fdd43886df3dc5663c8fee5f4 Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot
@FieldNameConstants was redesigned in lombok v1.18.4. +
+ The lombok.config option lombok.fieldNameConstants.uppercase = true
was added in lombok v1.18.8.
- 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 - write @FieldNameConstants(asEnum = true)
for the enum variant. @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 @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 - write @FieldNameConstants(asEnum = true)
for the enum variant. @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, unless you set the lombok.fieldNameConstants.uppercase = true
option in your lombok.config
file; in that case lombok will try to UPPER_CASE
the name.
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
.
@@ -39,6 +41,10 @@
lombok.fieldNameConstants.innerTypeName
= a string (default: 'Fields')
lombok.fieldNameConstants.uppercase
= [true
| false
] (default: false)
+ true
, attempt to uppercase the generated fields.