aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/ConfigurationKeys.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-05-21 22:57:45 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-05-21 22:57:45 +0200
commit7fe489686716e72983d2c3586c7e2e1e07200ba7 (patch)
tree88a3eb6d85a0d9af1f95dc222d49147f7e0e291c /src/core/lombok/ConfigurationKeys.java
parentbb66465751b8f0b129e53e639854f95fcdb3dca8 (diff)
downloadlombok-7fe489686716e72983d2c3586c7e2e1e07200ba7.tar.gz
lombok-7fe489686716e72983d2c3586c7e2e1e07200ba7.tar.bz2
lombok-7fe489686716e72983d2c3586c7e2e1e07200ba7.zip
Code review for `@CustomLog`, and added documentation and a changelog entry.
Diffstat (limited to 'src/core/lombok/ConfigurationKeys.java')
-rw-r--r--src/core/lombok/ConfigurationKeys.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index 951b2893..ecfddb2a 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -304,17 +304,16 @@ public class ConfigurationKeys {
// ----- NonNull -----
/**
- * lombok configuration: {@code lombok.nonNull.exceptionType} = &lt;String: <em>a java exception type</em>; either [{@code IllegalArgumentException} or: {@code NullPointerException}].
+ * lombok configuration: {@code lombok.nonNull.exceptionType} = one of: [{@code IllegalArgumentException}, {@code NullPointerException}, or {@code Assertion}].
*
- * Sets the exception to throw if {@code @NonNull} is applied to a method parameter, and a caller passes in {@code null}.
+ * Sets the exception to throw if {@code @NonNull} is applied to a method parameter, and a caller passes in {@code null}. If the chosen configuration is {@code Assertion}, an assertion is generated instead,
+ * which would mean your code throws an {@code AssertionError} if assertions are enabled, and does nothing if assertions are not enabled.
*/
public static final ConfigurationKey<NullCheckExceptionType> NON_NULL_EXCEPTION_TYPE = new ConfigurationKey<NullCheckExceptionType>("lombok.nonNull.exceptionType", "The type of the exception to throw if a passed-in argument is null (Default: NullPointerException).") {};
/**
* lombok configuration: {@code lombok.nonNull.flagUsage} = {@code WARNING} | {@code ERROR}.
*
- * <em>Implementation note: This field is supposed to be lombok.NonNull itself, but jdk6 and 7 have bugs where fields in annotations don't work well.</em>
- *
* If set, <em>any</em> usage of {@code @NonNull} results in a warning / error.
*/
public static final ConfigurationKey<FlagUsageType> NON_NULL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.nonNull.flagUsage", "Emit a warning or error if @NonNull is used.") {};
@@ -439,7 +438,7 @@ public class ConfigurationKeys {
public static final ConfigurationKey<FlagUsageType> LOG_CUSTOM_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.custom.flagUsage", "Emit a warning or error if @CustomLog is used.") {};
/**
- * lombok configuration: {@code lombok.log.custom.declaration} = &lt;String: logDeclaration&gt;.
+ * lombok configuration: {@code lombok.log.custom.declaration} = &lt;logDeclaration string&gt;.
*
* The log declaration must follow the pattern:
* <br>
@@ -447,15 +446,19 @@ public class ConfigurationKeys {
* <br>
* It consists of:
* <ul>
- * <li>Optional fully qualified logger type, e.g. {@code my.cool.Logger}, followed by space. If not specified, it defaults to the logger factory type.
+ * <li>Optional fully qualified logger type, e.g. {@code my.cool.Logger}, followed by space. If not specified, it defaults to the <em>LoggerFactoryType</em>.
* <li>Fully qualified logger factory type, e.g. {@code my.cool.LoggerFactory}, followed by dot.
- * <li>Factory method, e.g. {@code createLogger}. The method must be defined on the logger factory type and must be static.
- * <li>At least one definition of factory method parameters, e.g. {@code ()} or {@code (TOPIC,TYPE)}. The format is comma-separated list of parameters wrapped in parentheses.
- * The allowed parameters are: {@code TYPE} | {@code NAME} | {@code TOPIC} | {@code NULL}.
- * There can be at most one parameter definition with {@code TOPIC} and at most one without {@code TOPIC}.
+ * <li>Factory method, e.g. {@code createLogger}. This must be a {@code public static} method in the <em>LoggerFactoryType</em>.
+ * <li>At least one definition of factory method parameters, e.g. {@code ()} or {@code (TOPIC,TYPE)}. The format inside the parentheses is a comma-separated list of parameter kinds.<br>
+ * The allowed parameters are: {@code TYPE} | {@code NAME} | {@code TOPIC} | {@code NULL}.<br>
+ * There can be at most one parameter definition with {@code TOPIC} and at most one without {@code TOPIC}. You can specify both.
* </ul>
*
- * If not set, any usage of {@code @CustomLog} will result in an error.
+ * An example: {@code my.cool.Logger my.cool.LoggerFactory.createLogger(TYPE)(TYPE,TOPIC)}<br>
+ * If no topic is provided in the usage of {@code @CustomLog}, the above will invoke {@code LoggerFactory}'s {@code createLogger} method, passing in the type as a {@code java.lang.Class} variable.<br>
+ * If a topic is provided, the overload of that method is invoked with 2 parameters: First the type (as {@code Class}), then the topic (as {@code String}).
+ * <p>
+ * If this configuration key is not set, any usage of {@code @CustomLog} will result in an error.
*/
public static final ConfigurationKey<LogDeclaration> LOG_CUSTOM_DECLARATION = new ConfigurationKey<LogDeclaration>("lombok.log.custom.declaration", "Define the generated custom logger field.") {};