mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-03 11:12:33 +00:00
@Value's final-by-default and private-by-default with it; now appropriate warnings are emitted) * Builder now errors out on presence of most lombok annotations on an explicit builder class. * Builder now takes @FieldDefaults/@Value into account. * Builder on type now generates the constructor as package private instead of private to avoid synthetic accessor constructors. * added a bunch of test cases. * added a test case feature: If the expected file is omitted entirely but there are expected messages, the differences in the output itself are ignored. * streamlined checking for boolean-ness (removed some duplicate code) * added 'fluent' and 'chain' to @Builder.
44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
import java.util.List;
|
|
class BuilderSimple<T> {
|
|
private final int noshow = 0;
|
|
private final int yes;
|
|
private List<T> also;
|
|
private int $butNotMe;
|
|
@java.lang.SuppressWarnings("all")
|
|
BuilderSimple(final int yes, final List<T> also) {
|
|
this.yes = yes;
|
|
this.also = also;
|
|
}
|
|
@java.lang.SuppressWarnings("all")
|
|
public static class BuilderSimpleBuilder<T> {
|
|
private int yes;
|
|
private List<T> also;
|
|
@java.lang.SuppressWarnings("all")
|
|
BuilderSimpleBuilder() {
|
|
}
|
|
@java.lang.SuppressWarnings("all")
|
|
public BuilderSimpleBuilder<T> yes(final int yes) {
|
|
this.yes = yes;
|
|
return this;
|
|
}
|
|
@java.lang.SuppressWarnings("all")
|
|
public BuilderSimpleBuilder<T> also(final List<T> also) {
|
|
this.also = also;
|
|
return this;
|
|
}
|
|
@java.lang.SuppressWarnings("all")
|
|
public BuilderSimple<T> build() {
|
|
return new BuilderSimple<T>(yes, also);
|
|
}
|
|
@java.lang.Override
|
|
@java.lang.SuppressWarnings("all")
|
|
public java.lang.String toString() {
|
|
return "BuilderSimple.BuilderSimpleBuilder(yes=" + this.yes + ", also=" + this.also + ")";
|
|
}
|
|
}
|
|
@java.lang.SuppressWarnings("all")
|
|
public static <T> BuilderSimpleBuilder<T> builder() {
|
|
return new BuilderSimpleBuilder<T>();
|
|
}
|
|
}
|