Annotation Type Accessors
A container for settings for the generation of getters, setters and "with"-ers.
Complete documentation is found at the project lombok features page for @Accessors.
Using this annotation does nothing by itself; an annotation that makes lombok generate getters, setters, or "with"-ers
such as Setter
or Data
is also required.
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
If true, setters returnthis
instead ofvoid
.boolean
If true, accessors will be named after the field and not include aget
orset
prefix.boolean
If true, generated accessors will be markedfinal
.String[]
If present, only fields with any of the stated prefixes are given the getter/setter treatment.
-
Element Details
-
fluent
boolean fluentIf true, accessors will be named after the field and not include aget
orset
prefix. If true andchain
is omitted,chain
defaults totrue
.
NB: This setting has no effect on@With
; they always get a "with" prefix.
default: false- Returns:
- Whether or not to make fluent methods (named
fieldName()
, not for examplesetFieldName
).
- Default:
false
-
chain
boolean chainIf true, setters returnthis
instead ofvoid
. default: false, unlessfluent=true
, then default: true- Returns:
- Whether or not setters should return themselves (chaining) or
void
(no chaining).
- Default:
false
-
makeFinal
boolean makeFinalIf true, generated accessors will be markedfinal
. default: false- Returns:
- Whether or not accessors should be marked
final
.
- Default:
false
-
prefix
String[] prefixIf present, only fields with any of the stated prefixes are given the getter/setter treatment. Note that a prefix only counts if the next character is NOT a lowercase character or the last letter of the prefix is not a letter (for instance an underscore). If multiple fields all turn into the same name when the prefix is stripped, an error will be generated.- Returns:
- If you are in the habit of prefixing your fields (for example, you name them
fFieldName
, specify such prefixes here).
- Default:
{}
-