aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok/JacksonBuilderSingular.java
blob: b2bbfa5ae60bc6c59a82d6b42aed40c012b62f9a (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//version 8: Jackson deps are at least Java7+.
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonBuilderSingular.JacksonBuilderSingularBuilder.class)
public class JacksonBuilderSingular {
	@JsonAnySetter
	private Map<String, Object> any;
	@JsonProperty("v_a_l_u_e_s")
	private List<String> values;
	@JsonAnySetter
	private ImmutableMap<String, Object> guavaAny;
	@JsonProperty("guava_v_a_l_u_e_s")
	private ImmutableList<String> guavaValues;
	@java.lang.SuppressWarnings("all")
	JacksonBuilderSingular(final Map<String, Object> any, final List<String> values, final ImmutableMap<String, Object> guavaAny, final ImmutableList<String> guavaValues) {
		this.any = any;
		this.values = values;
		this.guavaAny = guavaAny;
		this.guavaValues = guavaValues;
	}
	@java.lang.SuppressWarnings("all")
	@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build")
	public static class JacksonBuilderSingularBuilder {
		@java.lang.SuppressWarnings("all")
		private java.util.ArrayList<String> any$key;
		@java.lang.SuppressWarnings("all")
		private java.util.ArrayList<Object> any$value;
		@java.lang.SuppressWarnings("all")
		private java.util.ArrayList<String> values;
		@java.lang.SuppressWarnings("all")
		private com.google.common.collect.ImmutableMap.Builder<String, Object> guavaAny;
		@java.lang.SuppressWarnings("all")
		private com.google.common.collect.ImmutableList.Builder<String> guavaValues;
		@java.lang.SuppressWarnings("all")
		JacksonBuilderSingularBuilder() {
		}
		@JsonAnySetter
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder any(final String anyKey, final Object anyValue) {
			if (this.any$key == null) {
				this.any$key = new java.util.ArrayList<String>();
				this.any$value = new java.util.ArrayList<Object>();
			}
			this.any$key.add(anyKey);
			this.any$value.add(anyValue);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder any(final java.util.Map<? extends String, ? extends Object> any) {
			if (any == null) {
				throw new java.lang.NullPointerException("any cannot be null");
			}
			if (this.any$key == null) {
				this.any$key = new java.util.ArrayList<String>();
				this.any$value = new java.util.ArrayList<Object>();
			}
			for (final java.util.Map.Entry<? extends String, ? extends Object> $lombokEntry : any.entrySet()) {
				this.any$key.add($lombokEntry.getKey());
				this.any$value.add($lombokEntry.getValue());
			}
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder clearAny() {
			if (this.any$key != null) {
				this.any$key.clear();
				this.any$value.clear();
			}
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder value(final String value) {
			if (this.values == null) this.values = new java.util.ArrayList<String>();
			this.values.add(value);
			return this;
		}
		@JsonProperty("v_a_l_u_e_s")
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder values(final java.util.Collection<? extends String> values) {
			if (values == null) {
				throw new java.lang.NullPointerException("values cannot be null");
			}
			if (this.values == null) this.values = new java.util.ArrayList<String>();
			this.values.addAll(values);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder clearValues() {
			if (this.values != null) this.values.clear();
			return this;
		}
		@JsonAnySetter
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder guavaAny(final String key, final Object value) {
			if (this.guavaAny == null) this.guavaAny = com.google.common.collect.ImmutableMap.builder();
			this.guavaAny.put(key, value);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder guavaAny(final java.util.Map<? extends String, ? extends Object> guavaAny) {
			if (guavaAny == null) {
				throw new java.lang.NullPointerException("guavaAny cannot be null");
			}
			if (this.guavaAny == null) this.guavaAny = com.google.common.collect.ImmutableMap.builder();
			this.guavaAny.putAll(guavaAny);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder clearGuavaAny() {
			this.guavaAny = null;
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder guavaValue(final String guavaValue) {
			if (this.guavaValues == null) this.guavaValues = com.google.common.collect.ImmutableList.builder();
			this.guavaValues.add(guavaValue);
			return this;
		}
		@JsonProperty("guava_v_a_l_u_e_s")
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder guavaValues(final java.lang.Iterable<? extends String> guavaValues) {
			if (guavaValues == null) {
				throw new java.lang.NullPointerException("guavaValues cannot be null");
			}
			if (this.guavaValues == null) this.guavaValues = com.google.common.collect.ImmutableList.builder();
			this.guavaValues.addAll(guavaValues);
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular.JacksonBuilderSingularBuilder clearGuavaValues() {
			this.guavaValues = null;
			return this;
		}
		@java.lang.SuppressWarnings("all")
		public JacksonBuilderSingular build() {
			java.util.Map<String, Object> any;
			switch (this.any$key == null ? 0 : this.any$key.size()) {
			case 0: 
				any = java.util.Collections.emptyMap();
				break;
			case 1: 
				any = java.util.Collections.singletonMap(this.any$key.get(0), this.any$value.get(0));
				break;
			default: 
				any = new java.util.LinkedHashMap<String, Object>(this.any$key.size() < 1073741824 ? 1 + this.any$key.size() + (this.any$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
				for (int $i = 0; $i < this.any$key.size(); $i++) any.put(this.any$key.get($i), (Object) this.any$value.get($i));
				any = java.util.Collections.unmodifiableMap(any);
			}
			java.util.List<String> values;
			switch (this.values == null ? 0 : this.values.size()) {
			case 0: 
				values = java.util.Collections.emptyList();
				break;
			case 1: 
				values = java.util.Collections.singletonList(this.values.get(0));
				break;
			default: 
				values = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.values));
			}
			com.google.common.collect.ImmutableMap<String, Object> guavaAny = this.guavaAny == null ? com.google.common.collect.ImmutableMap.<String, Object>of() : this.guavaAny.build();
			com.google.common.collect.ImmutableList<String> guavaValues = this.guavaValues == null ? com.google.common.collect.ImmutableList.<String>of() : this.guavaValues.build();
			return new JacksonBuilderSingular(any, values, guavaAny, guavaValues);
		}
		@java.lang.Override
		@java.lang.SuppressWarnings("all")
		public java.lang.String toString() {
			return "JacksonBuilderSingular.JacksonBuilderSingularBuilder(any$key=" + this.any$key + ", any$value=" + this.any$value + ", values=" + this.values + ", guavaAny=" + this.guavaAny + ", guavaValues=" + this.guavaValues + ")";
		}
	}
	@java.lang.SuppressWarnings("all")
	public static JacksonBuilderSingular.JacksonBuilderSingularBuilder builder() {
		return new JacksonBuilderSingular.JacksonBuilderSingularBuilder();
	}
}