From 6cc74e42295b6138629c6b32dd56a99ee8c2c646 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 20 Jan 2020 22:53:13 +0100 Subject: Website: style example code --- website/templates/features/configuration.html | 106 +++++++++++++------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'website/templates') diff --git a/website/templates/features/configuration.html b/website/templates/features/configuration.html index 62bac24a..4d7b1547 100644 --- a/website/templates/features/configuration.html +++ b/website/templates/features/configuration.html @@ -14,9 +14,9 @@ Usually, a user of lombok puts a lombok.config file with their preferences in a workspace or project root directory, with the special config.stopBubbling = true key to tell lombok this is your root directory. You can then create lombok.config files in any subdirectories (generally representing projects or source packages) with different settings.

An up to date list of all configuration keys supported by your version of lombok can be generated by running: -

- java -jar lombok.jar config -g --verbose -
+
    +
  1. java -jar lombok.jar config -g --verbose
  2. +
The output of the config tool is itself a valid lombok.config file.
The config tool can also be used to display the complete lombok configuration used for any given directory or source file by supplying these as arguments.

@@ -47,24 +47,24 @@

Configuration files are hierarchical: Any configuration setting applies to all source files in that directory, and all source files in subdirectories, but configuration settings closer to the source file take precedence. For example, if you have in /Users/me/projects/lombok.config the following: -

- lombok.log.fieldName = foobar -
+
    +
  1. lombok.log.fieldName = foobar
  2. +
and in /Users/me/projects/MyProject/lombok.config you have: -
- lombok.log.fieldName = xyzzy -
+
    +
  1. lombok.log.fieldName = xyzzy
  2. +
Then the various @Log annotations will use foobar instead of the default log as a field name to generate in all your projects, except for your project in /Users/me/projects/MyProject, where xyzzy is used instead.

To restore a configuration key set by a parent config file back to the default, the clear option can be used. For example, if a parent configuration file has configured all use of val to emit a warning, you can turn off the warnings for a subdirectory by including in it a lombok.config file with: -

- clear lombok.val.flagUsage -
+
    +
  1. clear lombok.val.flagUsage
  2. +

Some configuration keys take lists. For lists, use += to add an entry. You can remove a single item from the list (useful to undo a parent configuration file's setting) with -=. For example: -

- lombok.accessors.prefix += m_ -
+
    +
  1. lombok.accessors.prefix += m_
  2. +

Comments can be included in lombok.config files; any line that starts with # is considered a comment.

@@ -75,28 +75,28 @@

To stop lombok from looking at parent directories for more configuration files, the special key: -

- config.stopBubbling = true -
+
    +
  1. config.stopBubbling = true
  2. +
can be included. We suggest you put this in the root of your workspace directory.

Lombok can add @javax.annotation.Generated annotations to all generated nodes where possible. You can enable this with: -

- lombok.addJavaxGeneratedAnnotation = true -
+
    +
  1. lombok.addJavaxGeneratedAnnotation = true
  2. +
We advise against this; JDK9 breaks this annotation, and it's unlikely to ever get fixed.
NB: Until Lombok v1.16.20, this setting defaulted to true.

Lombok can be configured to add @lombok.Generated annotations to all generated nodes where possible; useful for JaCoCo (which has built in support), or other style checkers and code coverage tools: -

- lombok.addLombokGeneratedAnnotation = true -
+
    +
  1. lombok.addLombokGeneratedAnnotation = true
  2. +

Lombok can add the @SuppressFBWarnings annotation which is useful if you want to run FindBugs on your class files. To enable this feature, make sure findbugs is on the classpath when you compile, and add the following config key: -

- lombok.extern.findbugs.addSuppressFBWarnings = true -
+
    +
  1. lombok.extern.findbugs.addSuppressFBWarnings = true
  2. +

@@ -105,10 +105,10 @@

These config keys can make lombok affect source files even if they have 0 lombok annotations in them.
-

- lombok.fieldDefaults.defaultPrivate = true
- lombok.fieldDefaults.defaultFinal = true -
+
    +
  1. lombok.fieldDefaults.defaultPrivate = true
  2. +
  3. lombok.fieldDefaults.defaultFinal = true
  4. +
Turning either of these options on means lombok will make every field in every source file final and/or private unless it has an explicit access modifier or annotation to suppress this. See the @FieldDefaults documentation for more.

@@ -117,19 +117,19 @@ <@f.main.h3 title="Importing the configuration from a different file" />

At the top of a configuration file it is possible to import other configuration files. Imported files don't have to be called lombok.config and can have any file extension (or even none).
-

- import ../configuration/model.config -
+
    +
  1. import ../configuration/model.config
  2. +
The location of an imported file is resolved relative to the file that imports it.

For shared projects, it makes sense to always use relative paths. For individuals, it is also possible to use absolute paths.
-

- # Linux
- import /etc/lombok/model.config
- # Windows
- import d:/lombok/model.config -
+
    +
  1. # Linux
  2. +
  3. import /etc/lombok/model.config
  4. +
  5. # Windows
  6. +
  7. import d:/lombok/model.config
  8. +

Configuration files can import multiple configuration files as long as they are specified before any configuration key. @@ -142,23 +142,23 @@

It is also possible to import files from .jar and .zip files.
-

- # Use 'lombok.config' from the root of the archive.
- import ../deps/lombok-config.jar
- # Use a given file in the archive.
- import ../deps/lombok-config.zip!base/model.config -
+
    +
  1. # Use 'lombok.config' from the root of the archive.
  2. +
  3. import ../deps/lombok-config.jar
  4. +
  5. # Use a given file in the archive.
  6. +
  7. import ../deps/lombok-config.zip!base/model.config
  8. +
Configuration files inside archives can import other configuration files, provided that they are in the same archive.

When importing files, it is possible to use environment variables.
-

- # Environment variables are names surrounded by angle brackets (<, >).
- # They are replaced by System.getenv(name), if present.
- import <JAVA_PROJECTS>/shared.config
- # A tilde (~) at the start gets replaced by System.getProperty("user.home", "~").
- import ~/my.config -
+
    +
  1. # Environment variables are names surrounded by angle brackets (<, >).
  2. +
  3. # They are replaced by System.getenv(name), if present.
  4. +
  5. import <JAVA_PROJECTS>/shared.config
  6. +
  7. # A tilde (~) at the start gets replaced by System.getProperty("user.home", "~").
  8. +
  9. import ~/my.config
  10. +
As with absolute paths, this is more useful for individuals than for shared projects.

-- cgit