aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/experimental/ValueExample_post.jpage
blob: ac9b64d18d8514a72846e810448262b3969b033b (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
import java.util.Arrays;

public final class ValueExample {
	private final String name;
	private int age;
	private final double score;
	protected final String[] tags;
	
	@java.beans.ConstructorProperties({"name", "age", "score", "tags"})
	public ValueExample(String name, int age, double score, String[] tags) {
		this.name = name;
		this.age = age;
		this.score = score;
		this.tags = tags;
	}
	
	public String getName() {
		return this.name;
	}
	
	public int getAge() {
		return this.age;
	}
	
	public double getScore() {
		return this.score;
	}
	
	public String[] getTags() {
		return this.tags;
	}
	
	@java.lang.Override
	public boolean equals(Object o) {
		if (o == this) return true;
		if (!(o instanceof ValueExample)) return false;
		final ValueExample other = (ValueExample)o;
		final Object this$name = this.getName();
		final Object other$name = other.getName();
		if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
		if (this.getAge() != other.getAge()) return false;
		if (Double.compare(this.getScore(), other.getScore()) != 0) return false;
		if (!Arrays.deepEquals(this.getTags(), other.getTags())) return false;
		return true;
	}
	
	@java.lang.Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		final Object $name = this.getName();
		result = result * PRIME + ($name == null ? 0 : $name.hashCode());
		result = result * PRIME + this.getAge();
		final long $score = Double.doubleToLongBits(this.getScore());
		result = result * PRIME + (int)($score >>> 32 ^ $score);
		result = result * PRIME + Arrays.deepHashCode(this.getTags());
		return result;
	}
	
	@java.lang.Override
	public String toString() {
		return "ValueExample(name=" + getName() + ", age=" + getAge() + ", score=" + getScore() + ", tags=" + Arrays.deepToString(getTags()) + ")";
	}
	
	ValueExample withAge(int age) {
		return this.age == age ? this : new ValueExample(name, age, score, tags);
	}
	
	public static final class Exercise<T> {
		private final String name;
		private final T value;
		
		private Exercise(String name, T value) {
			this.name = name;
			this.value = value;
		}
		
		public static <T> Exercise<T> of(String name, T value) {
			return new Exercise<T>(name, value);
		}
		
		public String getName() {
			return this.name;
		}
		
		public T getValue() {
			return this.value;
		}
		
		@java.lang.Override
		public boolean equals(Object o) {
			if (o == this) return true;
			if (!(o instanceof ValueExample.Exercise)) return false;
			final Exercise<?> other = (Exercise<?>)o;
			final Object this$name = this.getName();
			final Object other$name = other.getName();
			if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
			final Object this$value = this.getValue();
			final Object other$value = other.getValue();
			if (this$value == null ? other$value != null : !this$value.equals(other$value)) return false;
			return true;
		}
		
		@java.lang.Override
		public int hashCode() {
			final int PRIME = 31;
			int result = 1;
			final Object $name = this.getName();
			result = result * PRIME + ($name == null ? 0 : $name.hashCode());
			final Object $value = this.getValue();
			result = result * PRIME + ($value == null ? 0 : $value.hashCode());
			return result;
		}
		
		@java.lang.Override
		public String toString() {
			return "ValueExample.Exercise(name=" + getName() + ", value=" + getValue() + ")";
		}
	}
}