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 return this instead of void.
      boolean fluent
      If true, accessors will be named after the field and not include a get or set prefix.
      java.lang.String[] prefix
      If present, only fields with any of the stated prefixes are given the getter/setter treatment.
    • Element Detail

      • fluent

        boolean fluent
        If true, accessors will be named after the field and not include a get or set prefix. If true and chain is omitted, chain defaults to true. default: false
        Returns:
        Whether or not to make fluent methods (named fieldName(), not for example setFieldName).
        Default:
        false
      • chain

        boolean chain
        If true, setters return this instead of void. default: false, unless fluent=true, then default: true
        Returns:
        Whether or not setters should return themselves (chaining) or void (no chaining).
        Default:
        false
      • prefix

        java.lang.String[] prefix
        If 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:
        {}