aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/Builder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok/Builder.java')
-rw-r--r--src/core/lombok/Builder.java33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/core/lombok/Builder.java b/src/core/lombok/Builder.java
index 7a965486..a16717cc 100644
--- a/src/core/lombok/Builder.java
+++ b/src/core/lombok/Builder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2014 The Project Lombok Authors.
+ * Copyright (C) 2013-2017 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
@@ -48,8 +48,8 @@ import java.lang.annotation.Target;
* as the relevant class, unless a method has been annotated, in which case it'll be equal to the
* return type of that method.
* <p>
- * Complete documentation is found at <a href="https://projectlombok.org/features/experimental/Builder.html">the project lombok features page for &#64;Builder</a>.
- * <p>
+ * Complete documentation is found at <a href="https://projectlombok.org/features/Builder">the project lombok features page for &#64;Builder</a>.
+ * <br>
* <p>
* Before:
*
@@ -107,10 +107,17 @@ import java.lang.annotation.Target;
@Target({TYPE, METHOD, CONSTRUCTOR})
@Retention(SOURCE)
public @interface Builder {
- /** Name of the method that creates a new builder instance. Default: {@code builder}. */
+ /**
+ * The field annotated with {@code @Default} must have an initializing expression; that expression is taken as the default to be used if not explicitly set during building.
+ */
+ @Target(FIELD)
+ @Retention(SOURCE)
+ public @interface Default {}
+
+ /** @return Name of the method that creates a new builder instance. Default: {@code builder}. */
String builderMethodName() default "builder";
- /** Name of the method in the builder class that creates an instance of your {@code @Builder}-annotated class. */
+ /** @return Name of the method in the builder class that creates an instance of your {@code @Builder}-annotated class. */
String buildMethodName() default "build";
/**
@@ -119,6 +126,8 @@ public @interface Builder {
* Default for {@code @Builder} on types and constructors: {@code (TypeName)Builder}.
* <p>
* Default for {@code @Builder} on methods: {@code (ReturnTypeName)Builder}.
+ *
+ * @return Name of the builder class that will be generated (or if it already exists, will be filled with builder elements).
*/
String builderClassName() default "";
@@ -126,6 +135,8 @@ public @interface Builder {
* If true, generate an instance method to obtain a builder that is initialized with the values of this instance.
* Legal only if {@code @Builder} is used on a constructor, on the type itself, or on a static method that returns
* an instance of the declaring type.
+ *
+ * @return Whether to generate a {@code toBuilder()} method.
*/
boolean toBuilder() default false;
@@ -142,13 +153,19 @@ public @interface Builder {
@Target({FIELD, PARAMETER})
@Retention(SOURCE)
public @interface ObtainVia {
- /** Tells lombok to obtain a value with the expression {@code this.value}. */
+ /**
+ * @return Tells lombok to obtain a value with the expression {@code this.value}.
+ */
String field() default "";
- /** Tells lombok to obtain a value with the expression {@code this.method()}. */
+ /**
+ * @return Tells lombok to obtain a value with the expression {@code this.method()}.
+ */
String method() default "";
- /** Tells lombok to obtain a value with the expression {@code SelfType.method(this)}; requires {@code method} to be set. */
+ /**
+ * @return Tells lombok to obtain a value with the expression {@code SelfType.method(this)}; requires {@code method} to be set.
+ */
boolean isStatic() default false;
}
}