View Javadoc
1   /*
2    * Copyright (C) 2010-2017 The Project Lombok Authors.
3    * 
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   * 
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   * 
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   * THE SOFTWARE.
21   */
22  package lombok;
23  
24  import java.lang.annotation.ElementType;
25  import java.lang.annotation.Retention;
26  import java.lang.annotation.RetentionPolicy;
27  import java.lang.annotation.Target;
28  
29  /**
30   * Generates an all-args constructor.
31   * An all-args constructor requires one argument for every field in the class.
32   * <p>
33   * Complete documentation is found at <a href="https://projectlombok.org/features/constructor">the project lombok features page for &#64;Constructor</a>.
34   * <p>
35   * Even though it is not listed, this annotation also has the {@code onConstructor} parameter. See the full documentation for more details.
36   * 
37   * @see NoArgsConstructor
38   * @see RequiredArgsConstructor
39   */
40  @Target(ElementType.TYPE)
41  @Retention(RetentionPolicy.SOURCE)
42  public @interface AllArgsConstructor {
43  	/**
44  	 * If set, the generated constructor will be private, and an additional static 'constructor'
45  	 * is generated with the same argument list that wraps the real constructor.
46  	 * 
47  	 * Such a static 'constructor' is primarily useful as it infers type arguments.
48  	 * 
49  	 * @return Name of static 'constructor' method to generate (blank = generate a normal constructor).
50  	 */
51  	String staticName() default "";
52  	
53  	/**
54  	 * Any annotations listed here are put on the generated constructor.
55  	 * The syntax for this feature depends on JDK version (nothing we can do about that; it's to work around javac bugs).<br>
56  	 * up to JDK7:<br>
57  	 *  {@code @AllArgsConstructor(onConstructor=@__({@AnnotationsGoHere}))}<br>
58  	 * from JDK8:<br>
59  	 *  {@code @AllArgsConstructor(onConstructor_={@AnnotationsGohere})} // note the underscore after {@code onConstructor}.
60  	 *  
61  	 * @return List of annotations to apply to the generated constructor.
62  	 */
63  	AnyAnnotation[] onConstructor() default {};
64  	
65  	/**
66  	 * Sets the access level of the constructor. By default, generated constructors are {@code public}.
67  	 * 
68  	 * @return The constructor will be generated with this access modifier.
69  	 */
70  	AccessLevel access() default lombok.AccessLevel.PUBLIC;
71  	
72  	/**
73  	  * Placeholder annotation to enable the placement of annotations on the generated code.
74  	  * 
75  	  * @deprecated Don't use this annotation, ever - Read the documentation.
76  	  */
77  	@Deprecated
78  	@Retention(RetentionPolicy.SOURCE)
79  	@Target({})
80  	@interface AnyAnnotation {}
81  }