Annotation Type AllArgsConstructor
Generates an all-args constructor.
An all-args constructor requires one argument for every field in the class.
Complete documentation is found at the project lombok features page for @Constructor.
Even though it is not listed, this annotation also has the onConstructor
parameter. See the full documentation for more details.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Deprecated.Don't use this annotation, ever - Read the documentation. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionSets the access level of the constructor.Any annotations listed here are put on the generated constructor.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.
-
Element Details
-
staticName
String staticNameIf set, the generated constructor will be private, and an additional static 'constructor' is generated with the same argument list that wraps the real constructor. Such a static 'constructor' is primarily useful as it infers type arguments.- Returns:
- Name of static 'constructor' method to generate (blank = generate a normal constructor).
- Default:
""
-
onConstructor
AllArgsConstructor.AnyAnnotation[] onConstructorAny annotations listed here are put on the generated constructor. The syntax for this feature depends on JDK version (nothing we can do about that; it's to work around javac bugs).
up to JDK7:
@AllArgsConstructor(onConstructor=@__({@AnnotationsGoHere}))
from JDK8:
@AllArgsConstructor(onConstructor_={@AnnotationsGohere})
// note the underscore afteronConstructor
.- Returns:
- List of annotations to apply to the generated constructor.
- Default:
{}
-
access
AccessLevel accessSets the access level of the constructor. By default, generated constructors arepublic
.- Returns:
- The constructor will be generated with this access modifier.
- Default:
PUBLIC
-