aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java
blob: 45ff97fa6f7d2af8a50724660f1bf5cf0699d2bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//version 8:
import java.util.List;
import java.util.Collection;
class BuilderSingularNullBehavior1 {
	private List<String> names;
	private List<String> locations;
	@java.lang.SuppressWarnings("all")
	BuilderSingularNullBehavior1(final List<String> names, final List<String> locations) {
		this.names = names;
		this.locations = locations;
	}
	@java.lang.SuppressWarnings("all")
	public static class BuilderSingularNullBehavior1Builder {
		@java.lang.SuppressWarnings("all")
		private java.util.ArrayList<String> names;
		@java.lang.SuppressWarnings("all")
		private java.util.ArrayList<String> locations;
		@java.lang.SuppressWarnings("all")
		BuilderSingularNullBehavior1Builder() {
		}
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder name(final String name) {
			if (this.names == null) this.names = new java.util.ArrayList<String>();
			this.names.add(name);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder names(final java.util.@org.checkerframework.checker.nullness.qual.NonNull Collection<? extends String> names) {
			assert names != null : "names cannot be null";
			if (this.names == null) this.names = new java.util.ArrayList<String>();
			this.names.addAll(names);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder clearNames() {
			if (this.names != null) this.names.clear();
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder location(final String location) {
			if (this.locations == null) this.locations = new java.util.ArrayList<String>();
			this.locations.add(location);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder locations(final java.util.@org.checkerframework.checker.nullness.qual.Nullable Collection<? extends String> locations) {
			if (locations != null) {
				if (this.locations == null) this.locations = new java.util.ArrayList<String>();
				this.locations.addAll(locations);
			}
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder clearLocations() {
			if (this.locations != null) this.locations.clear();
			return this;
		}
		@org.checkerframework.checker.nullness.qual.NonNull
		@java.lang.SuppressWarnings("all")
		public BuilderSingularNullBehavior1 build() {
			java.util.List<String> names;
			switch (this.names == null ? 0 : this.names.size()) {
			case 0: 
				names = java.util.Collections.emptyList();
				break;
			case 1: 
				names = java.util.Collections.singletonList(this.names.get(0));
				break;
			default: 
				names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.names));
			}
			java.util.List<String> locations;
			switch (this.locations == null ? 0 : this.locations.size()) {
			case 0: 
				locations = java.util.Collections.emptyList();
				break;
			case 1: 
				locations = java.util.Collections.singletonList(this.locations.get(0));
				break;
			default: 
				locations = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.locations));
			}
			return new BuilderSingularNullBehavior1(names, locations);
		}
		@java.lang.Override
		@java.lang.SuppressWarnings("all")
		public java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() {
			return "BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder(names=" + this.names + ", locations=" + this.locations + ")";
		}
	}
	@java.lang.SuppressWarnings("all")
	public static BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder builder() {
		return new BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder();
	}
}