Package lombok.experimental
Annotation Type Accessors
@Target({TYPE,FIELD})
@Retention(SOURCE)
public @interface Accessors
A container for settings for the generation of getters and setters.
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 and setters,
such as Setter
or Data
is also required.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
chain
If true, setters returnthis
instead ofvoid
.boolean
fluent
If true, accessors will be named after the field and not include aget
orset
prefix.java.lang.String[]
prefix
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
. 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
-
prefix
java.lang.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:
- {}
-