diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-12-22 04:40:54 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-01-18 18:55:52 +0100 |
commit | d680f8c7f48b6a982c2cea0e8758716eee4807bc (patch) | |
tree | 7b4465ecd8c07bec61402f1f65e9b4ff550a51e2 /src/core/lombok/experimental | |
parent | f6eef8e50a9cde3643541c077bd138230ff5b96a (diff) | |
download | lombok-d680f8c7f48b6a982c2cea0e8758716eee4807bc.tar.gz lombok-d680f8c7f48b6a982c2cea0e8758716eee4807bc.tar.bz2 lombok-d680f8c7f48b6a982c2cea0e8758716eee4807bc.zip |
[configuration] initial batch of configuration keys, primarily for flag usages.
Diffstat (limited to 'src/core/lombok/experimental')
-rw-r--r-- | src/core/lombok/experimental/Accessors.java | 12 | ||||
-rw-r--r-- | src/core/lombok/experimental/Builder.java | 10 | ||||
-rw-r--r-- | src/core/lombok/experimental/ExtensionMethod.java | 12 | ||||
-rw-r--r-- | src/core/lombok/experimental/FieldDefaults.java | 11 | ||||
-rw-r--r-- | src/core/lombok/experimental/Wither.java | 9 |
5 files changed, 51 insertions, 3 deletions
diff --git a/src/core/lombok/experimental/Accessors.java b/src/core/lombok/experimental/Accessors.java index 2748bfa9..a74cbb91 100644 --- a/src/core/lombok/experimental/Accessors.java +++ b/src/core/lombok/experimental/Accessors.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; + /** * A container for settings for the generation of getters and setters. * <p> @@ -38,6 +41,13 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) public @interface Accessors { /** + * lombok configuration: {@code lombok.Accessors.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Accessors} results in a warning / error. + */ + ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Accessors.flagUsage") {}; + + /** * If true, accessors will be named after the field and not include a <code>get</code> or <code>set</code> * prefix. If true and <code>chain</code> is omitted, <code>chain</code> defaults to <code>true</code>. * <strong>default: false</strong> diff --git a/src/core/lombok/experimental/Builder.java b/src/core/lombok/experimental/Builder.java index 1300e7d3..56675dd1 100644 --- a/src/core/lombok/experimental/Builder.java +++ b/src/core/lombok/experimental/Builder.java @@ -27,6 +27,9 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.Retention; import java.lang.annotation.Target; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; + /** * The builder annotation creates a so-called 'builder' aspect to the class that is annotated or the class * that contains a member which is annotated with {@code @Builder}. @@ -107,6 +110,13 @@ import java.lang.annotation.Target; @Target({TYPE, METHOD, CONSTRUCTOR}) @Retention(SOURCE) public @interface Builder { + /** + * lombok configuration: {@code lombok.Builder.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Builder} results in a warning / error. + */ + ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Builder.flagUsage") {}; + /** Name of the static method that creates a new builder instance. Default: {@code builder}. */ String builderMethodName() default "builder"; diff --git a/src/core/lombok/experimental/ExtensionMethod.java b/src/core/lombok/experimental/ExtensionMethod.java index 44f28d04..483ede33 100644 --- a/src/core/lombok/experimental/ExtensionMethod.java +++ b/src/core/lombok/experimental/ExtensionMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,9 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; + /** * Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or * otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as @@ -60,6 +63,13 @@ import java.lang.annotation.*; @Target(TYPE) @Retention(SOURCE) public @interface ExtensionMethod { + /** + * lombok configuration: {@code lombok.ExtensionMethod.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @ExtensionMethod} results in a warning / error. + */ + ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.ExtensionMethod.flagUsage") {}; + /** All types whose static methods will be exposed as extension methods. */ Class<?>[] value(); diff --git a/src/core/lombok/experimental/FieldDefaults.java b/src/core/lombok/experimental/FieldDefaults.java index 8a3fb534..9a17efbc 100644 --- a/src/core/lombok/experimental/FieldDefaults.java +++ b/src/core/lombok/experimental/FieldDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2013 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,6 +27,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import lombok.AccessLevel; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; /** * Adds modifiers to each field in the type with this annotation. @@ -41,6 +43,13 @@ import lombok.AccessLevel; @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) public @interface FieldDefaults { + /** + * lombok configuration: {@code lombok.FieldDefaults.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @FieldDefaults} results in a warning / error. + */ + ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.FieldDefaults.flagUsage") {}; + AccessLevel level() default AccessLevel.NONE; boolean makeFinal() default false; } diff --git a/src/core/lombok/experimental/Wither.java b/src/core/lombok/experimental/Wither.java index f667cb1f..259e0c5e 100644 --- a/src/core/lombok/experimental/Wither.java +++ b/src/core/lombok/experimental/Wither.java @@ -27,6 +27,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import lombok.AccessLevel; +import lombok.core.FlagUsageType; +import lombok.core.configuration.ConfigurationKey; /** * Put on any field to make lombok build a 'wither' - a withX method which produces a clone of this object (except for 1 field which gets a new value). @@ -55,6 +57,13 @@ import lombok.AccessLevel; @Retention(RetentionPolicy.SOURCE) public @interface Wither { /** + * lombok configuration: {@code lombok.Wither.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Value} results in a warning / error. + */ + ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Wither.flagUsage") {}; + + /** * If you want your wither to be non-public, you can specify an alternate access level here. */ AccessLevel value() default AccessLevel.PUBLIC; |