From 261758b4448b3d48ff2f48926ffcb8ea66121603 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 8 Feb 2022 06:02:05 +0100 Subject: [implements #1456] accessors can now be made final via `@Accessors`. --- .../templates/features/experimental/Accessors.html | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'website') diff --git a/website/templates/features/experimental/Accessors.html b/website/templates/features/experimental/Accessors.html index 9a9385cb..d30151a5 100644 --- a/website/templates/features/experimental/Accessors.html +++ b/website/templates/features/experimental/Accessors.html @@ -6,7 +6,13 @@ @Accessors was introduced as experimental feature in lombok v0.11.0.

The lombok.config option lombok.accessors.capitalization = [basic | beanspec] was added in lombok v1.18.24. -

+

+ FUNCTIONAL CHANGE: @Accessors now 'cascades'; any options not set on a field-level @Accessors annotation will get inherited from an + @Accessors annotation on the class (and any options not set on those, from the enclosing class). Finally, anything set in lombok.config + will be used as default. (lombok v1.18.24) +

+ NEW FEATURE: @Accessors(makeFinal = true) will create final getters, setters, and with-ers. There's also + lombok.config key lombok.accessors.makeFinal for the same effect. (lombok v1.18.24) <@f.experimental> @@ -14,7 +20,7 @@

  • We may want to roll these features into a more complete property support concept.
  • - New feature – community feedback requested. + The makeFinal feature is recently released; awaiting community feedback.
  • Current status: neutral - Some changes are expected. These changes are intended to be backwards compatible, but should start in an experimental feature: @@ -26,13 +32,13 @@ <@f.overview>

    - The @Accessors annotation is used to configure how lombok generates and looks for getters and setters. + The @Accessors annotation is used to configure how lombok generates and looks for getters, setters, and with-ers.

    By default, lombok follows the bean specification for getters and setters: The getter for a field named pepper is getPepper for example. However, some might like to break with the bean specification in order to end up with nicer looking APIs. @Accessors lets you do this.

    Some programmers like to use a prefix for their fields, i.e. they write fPepper instead of pepper. We strongly discourage doing this, as you can't unit test the validity of your prefixes, and refactor scripts may turn fields into local variables or method names. Furthermore, your tools (such as your editor) can take care of rendering the identifier in a certain way if you want this information to be instantly visible. Nevertheless, you can list the prefixes that your project uses via @Accessors as well.

    - @Accessors therefore has 3 options: + @Accessors has 4 options:

    - The @Accessors annotation is legal on types and fields; the annotation that applies is the one on the field if present, otherwise the one on the class. When an @Accessors annotation on a field is present, any @Accessors annotation also present on the class the field is in, is entirely ignored, even for properties not configured on the field @Accessors. This in contrast to any lombok.config configuration keys which serve as fall-back default if any explicit @Accessors annotation doesn't specify. + The @Accessors annotation is legal on types and fields; getters/setters/with-ers will look at the annotation on the field first, on the type the field is in second (and you have types in types, + each outer type is also checked), and finally for any properties not explicitly set, the appropriate lombok.config setting is used.

    @@ -55,11 +65,15 @@
    lombok.accessors.chain = [true | false] (default: false)
    - If set to true, any class that either doesn't have an @Accessors annotation, or it does, but that annotation does not have an explicit value for the chain parameter, will act as if @Accessors(chain = true) is present. + If set to true, any field/class that either doesn't have an @Accessors annotation, or it does, but that annotation does not have an explicit value for the chain parameter, will act as if @Accessors(chain = true) is present.
    lombok.accessors.fluent = [true | false] (default: false)
    - If set to true, any class that either doesn't have an @Accessors annotation, or it does, but that annotation does not have an explicit value for the fluent parameter, will act as if @Accessors(fluent = true) is present. + If set to true, any field/class that either doesn't have an @Accessors annotation, or it does, but that annotation does not have an explicit value for the fluent parameter, will act as if @Accessors(fluent = true) is present. +
    + lombok.accessors.makeFinal = [true | false] (default: false) +
    + If set to true, any field/class that either doesn't have an @Accessors annotation, or it does, but that annotation does not have an explicit value for the makeFinal parameter, will act as if @Accessors(makeFinal = true) is present.
    lombok.accessors.prefix += a field prefix (default: empty list)
    -- cgit