[configuration] initial batch of configuration keys, primarily for flag usages.

This commit is contained in:
Reinier Zwitserloot committed 2014-01-18 18:55:52 +01:00
1 parent f6eef8e50a
commit d680f8c7f4
29 files changed
+375 -16

No files matched your search

+10
View File
@@ -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;
/**
* Generates an all-args constructor.
* An all-args constructor requires one argument for every field in the class.
@@ -40,6 +43,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface AllArgsConstructor {
/**
* lombok configuration: {@code lombok.AllArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @AllArgsConstructor} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.AllArgsConstructor.flagUsage") {};
/**
* If set, the generated constructor will be private, and an additional static 'constructor'
* is generated with the same argument list that wraps the real constructor.
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009 The Project Lombok Authors.
* Copyright (C) 2009-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;
/**
* Ensures the variable declaration that you annotate will be cleaned up by calling its close method, regardless
* of what happens. Implemented by wrapping all statements following the local variable declaration to the
@@ -72,6 +75,13 @@ import java.lang.annotation.Target;
@Target(ElementType.LOCAL_VARIABLE)
@Retention(RetentionPolicy.SOURCE)
public @interface Cleanup {
/**
* lombok configuration: {@code lombok.Cleanup.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Cleanup} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Cleanup.flagUsage") {};
/** The name of the method that cleans up the resource. By default, 'close'. The method must not have any parameters. */
String value() default "close";
}
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright (C) 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok;
import lombok.core.FlagUsageType;
import lombok.core.configuration.ConfigurationKey;
/**
* A container class containing all lombok configuration keys that do not belong to a specific annotation.
*/
public class ConfigurationKeys {
private ConfigurationKeys() {}
/**
* lombok configuration: {@code lombok.AnyConstructor.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @AllArgsConstructor}, {@code @RequiredArgsConstructor}, or {@code @NoArgsConstructor} results in a warning / error.
*/
public static final ConfigurationKey<FlagUsageType> ANY_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.AnyConstructor.flagUsage") {};
/**
* lombok configuration: {@code lombok.log.any.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of any of the log annotations in {@code lombok.extern}{@code @Slf4j} results in a warning / error.
*/
public static final ConfigurationKey<FlagUsageType> ANY_LOG_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.any.flagUsage") {};
/**
* lombok configuration: {@code lombok.experimental.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of any experimental features (from package {@code lombok.experimental}) that haven't been
* promoted to a main feature results in a warning / error.
*/
public static final ConfigurationKey<FlagUsageType> EXPERIMENTAL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.experimental.flagUsage") {};
}
+10
View File
@@ -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;
/**
* Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check
* all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor.
@@ -44,6 +47,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Data {
/**
* lombok configuration: {@code lombok.Data.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Data} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Data.flagUsage") {};
/**
* If you specify a static constructor name, then the generated constructor will be private, and
* instead a static factory method is created that other classes can use to create instances.
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2012 The Project Lombok Authors.
* Copyright (C) 2010-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;
/**
* Put on any field to make lombok generate delegate methods that forward the call to this field.
*
@@ -45,6 +48,13 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
public @interface Delegate {
/**
* lombok configuration: {@code lombok.Delegate.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Delegate} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Delegate.flagUsage") {};
/**
* Normally the type of the field is used as delegate type. However, to choose a different type to delegate, you can list one (or more) types here. Note that types with
* type arguments can only be done as a field type. A solution for this is to create a private inner interface/class with the appropriate types extended, and possibly
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 The Project Lombok Authors.
* Copyright (C) 2009-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;
/**
* Generates implementations for the {@code equals} and {@code hashCode} methods inherited by all objects, based on relevant fields.
* <p>
@@ -34,6 +37,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface EqualsAndHashCode {
/**
* lombok configuration: {@code lombok.EqualsAndHashCode.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @EqualsAndHashCode} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.EqualsAndHashCode.flagUsage") {};
/**
* Any fields listed here will not be taken into account in the generated
* {@code equals} and {@code hashCode} implementations.
+10
View File
@@ -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;
/**
* Put on any field to make lombok build a standard getter.
* <p>
@@ -52,6 +55,13 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface Getter {
/**
* lombok configuration: {@code lombok.Getter.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Getter} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Getter.flagUsage") {};
/**
* If you want your getter to be non-public, you can specify an alternate access level here.
*/
+10
View File
@@ -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;
/**
* Generates a no-args constructor.
* Will generate an error message if such a constructor cannot be written due to the existence of final fields.
@@ -42,6 +45,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface NoArgsConstructor {
/**
* lombok configuration: {@code lombok.NoArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @NoArgsConstructor} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.NoArgsConstructor.flagUsage") {};
/**
* If set, the generated constructor will be private, and an additional static 'constructor'
* is generated with the same argument list that wraps the real constructor.
+18 -1
View File
@@ -27,6 +27,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;
/**
* If put on a parameter, lombok will insert a null-check at the start of the method / constructor's body, throwing a
* {@code NullPointerException} with the parameter's name as message. If put on a field, any generated method assigning
@@ -44,4 +47,18 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
@Retention(RetentionPolicy.CLASS)
@Documented
public @interface NonNull {}
public @interface NonNull {
/**
* lombok configuration: {@code lombok.NonNull.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @NonNull} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.NonNull.flagUsage") {};
/**
* lombok configuration: {@code lombok.NonNull.noNullChecks} = {@code true} | {@code false}.
*
* If set, the lombok feature of generating a null-checking if statement for all parameters annotated with {@code @NonNull} is disabled.
*/
ConfigurationKey<Boolean> NO_NULL_CHECKS = new ConfigurationKey<Boolean>("lombok.NonNull.noNullChecks") {};
}
@@ -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;
/**
* Generates a constructor with required arguments.
* Required arguments are final fields and fields with constraints such as {@code @NonNull}.
@@ -40,6 +43,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface RequiredArgsConstructor {
/**
* lombok configuration: {@code lombok.RequiredArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @RequiredArgsConstructor} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.RequiredArgsConstructor.flagUsage") {};
/**
* If set, the generated constructor will be private, and an additional static 'constructor'
* is generated with the same argument list that wraps the real constructor.
+10
View File
@@ -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;
/**
* Put on any field to make lombok build a standard setter.
* <p>
@@ -53,6 +56,13 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.SOURCE)
public @interface Setter {
/**
* lombok configuration: {@code lombok.Setter.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Setter} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Setter.flagUsage") {};
/**
* If you want your setter to be non-public, you can specify an alternate access level here.
*/
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 The Project Lombok Authors.
* Copyright (C) 2009-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;
/**
* &#64;SneakyThrow will avoid javac's insistence that you either catch or throw onward any checked exceptions that
* statements in your method body declare they generate.
@@ -59,6 +62,13 @@ import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.SOURCE)
public @interface SneakyThrows {
/**
* lombok configuration: {@code lombok.SneakyThrows.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @SneakyThrows} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.SneakyThrows.flagUsage") {};
/** The exception type(s) you want to sneakily throw onward. */
Class<? extends Throwable>[] value() default java.lang.Throwable.class;
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 The Project Lombok Authors.
* Copyright (C) 2009-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;
/**
* Almost exactly like putting the 'synchronized' keyword on a method, except will synchronize on a private internal
* Object, so that other code not under your control doesn't meddle with your thread management by locking on
@@ -40,6 +43,13 @@ import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Synchronized {
/**
* lombok configuration: {@code lombok.Synchronized.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Synchronized} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Synchronized.flagUsage") {};
/**
* Optional: specify the name of a different field to lock on. It is a compile time error if this field
* doesn't already exist (the fields are automatically generated only if you don't specify a specific name.
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 The Project Lombok Authors.
* Copyright (C) 2009-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;
/**
* Generates an implementation for the {@code toString} method inherited by all objects, consisting of printing the values of relevant fields.
* <p>
@@ -34,6 +37,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface ToString {
/**
* lombok configuration: {@code lombok.ToString.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @ToString} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.ToString.flagUsage") {};
/**
* Include the name of each field when printing it.
* <strong>default: true</strong>
+10
View File
@@ -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;
/**
* Generates a lot of code which fits with a class that is a representation of an immutable entity.
* <p>
@@ -43,6 +46,13 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Value {
/**
* lombok configuration: {@code lombok.Value.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.Value.flagUsage") {};
/**
* If you specify a static constructor name, then the generated constructor will be private, and
* instead a static factory method is created that other classes can use to create instances.
+6
View File
@@ -0,0 +1,6 @@
package lombok.core;
/** Used for lombok configuration to flag usages of certain lombok feature. */
public enum FlagUsageType {
WARNING, ERROR;
}
@@ -21,8 +21,10 @@
*/
package lombok.core.handlers;
import lombok.core.FlagUsageType;
import lombok.core.JavaIdentifiers;
import lombok.core.LombokNode;
import lombok.core.configuration.ConfigurationKey;
public class HandlerUtil {
private HandlerUtil() {}
@@ -45,4 +47,41 @@ public class HandlerUtil {
return true;
}
public static void handleFlagUsage(LombokNode<?, ?, ?> node, ConfigurationKey<FlagUsageType> key, String featureName) {
FlagUsageType fut = node.getAst().readConfiguration(key);
if (fut != null) {
String msg = "Use of " + featureName + " is flagged according to lombok configuration.";
if (fut == FlagUsageType.WARNING) node.addWarning(msg);
else node.addError(msg);
}
}
public static void handleFlagUsage(LombokNode<?, ?, ?> node, ConfigurationKey<FlagUsageType> key1, String featureName1, ConfigurationKey<FlagUsageType> key2, String featureName2) {
FlagUsageType fut1 = node.getAst().readConfiguration(key1);
FlagUsageType fut2 = node.getAst().readConfiguration(key2);
FlagUsageType fut = null;
String featureName = null;
if (fut1 == FlagUsageType.ERROR) {
fut = fut1;
featureName = featureName1;
} else if (fut2 == FlagUsageType.ERROR) {
fut = fut2;
featureName = featureName2;
} else if (fut1 == FlagUsageType.WARNING) {
fut = fut1;
featureName = featureName1;
} else {
fut = fut2;
featureName = featureName2;
}
if (fut != null) {
String msg = "Use of " + featureName + " is flagged according to lombok configuration.";
if (fut == FlagUsageType.WARNING) node.addWarning(msg);
else node.addError(msg);
}
}
}
+11 -1
View File
@@ -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>
@@ -37,6 +40,13 @@ import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.FIELD})
@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>.
+10
View File
@@ -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";
@@ -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();
@@ -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;
}
+9
View File
@@ -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).
@@ -54,6 +56,13 @@ import lombok.AccessLevel;
@Target({ElementType.FIELD, ElementType.TYPE})
@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.
*/
+10 -1
View File
@@ -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;
/**
* Causes lombok to generate a logger field.
* <p>
@@ -59,4 +62,10 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface CommonsLog {
}
/**
* lombok configuration: {@code lombok.log.apacheCommons.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @CommonsLog} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.apacheCommons.flagUsage") {};
}
+10 -1
View File
@@ -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;
/**
* Causes lombok to generate a logger field.
* <p>
@@ -58,4 +61,10 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface Log {
}
/**
* lombok configuration: {@code lombok.log.javaUtilLogging.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Log} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.javaUtilLogging.flagUsage") {};
}
+10 -1
View File
@@ -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;
/**
* Causes lombok to generate a logger field.
* <p>
@@ -59,4 +62,10 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface Log4j {
}
/**
* lombok configuration: {@code lombok.log.log4j.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Log4j} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.log4j.flagUsage") {};
}
+10 -1
View File
@@ -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;
/**
* Causes lombok to generate a logger field.
* <p>
@@ -59,4 +62,10 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface Log4j2 {
}
/**
* lombok configuration: {@code lombok.log.log4j2.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Log4j2} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.log4j2.flagUsage") {};
}
+10
View File
@@ -25,6 +25,9 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import lombok.core.FlagUsageType;
import lombok.core.configuration.ConfigurationKey;
/**
* Causes lombok to generate a logger field.
* <p>
@@ -56,4 +59,11 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface Slf4j {
/**
* lombok configuration: {@code lombok.log.slf4j.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Slf4j} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.slf4j.flagUsage") {};
}
+9
View File
@@ -25,6 +25,9 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import lombok.core.FlagUsageType;
import lombok.core.configuration.ConfigurationKey;
/**
* Causes lombok to generate a logger field.
* <p>
@@ -57,4 +60,10 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface XSlf4j {
/**
* lombok configuration: {@code lombok.log.xslf4j.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @XSlf4j} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.xslf4j.flagUsage") {};
}
+12 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2012 The Project Lombok Authors.
* Copyright (C) 2010-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
@@ -21,6 +21,9 @@
*/
package lombok;
import lombok.core.FlagUsageType;
import lombok.core.configuration.ConfigurationKey;
/**
* Use {@code val} as the type of any local variable declaration (even in a for-each statement), and the type will be inferred from the initializing expression.
* For example: {@code val x = 10.0;} will infer {@code double}, and {@code val y = new ArrayList<String>();} will infer {@code ArrayList<String>}. The local variable
@@ -30,4 +33,11 @@ package lombok;
* <p>
* Complete documentation is found at <a href="http://projectlombok.org/features/val.html">the project lombok features page for &#64;val</a>.
*/
public @interface val {}
public @interface val {
/**
* lombok configuration: {@code lombok.val.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code val} results in a warning / error.
*/
ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.val.flagUsage") {};
}