1
2
3
4 package de.powerstat.validation.values;
5
6
7 import java.util.Objects;
8
9 import de.powerstat.validation.interfaces.IValueObject;
10
11
12
13
14
15
16
17 public final class BFPONumber implements Comparable<BFPONumber>, IValueObject
18 {
19
20
21
22
23
24
25
26
27 private final int bFPONumber;
28
29
30
31
32
33
34
35
36 private BFPONumber(final int bFPONumber)
37 {
38 super();
39 if ((bFPONumber < 1) || (bFPONumber > 2035))
40 {
41 throw new IndexOutOfBoundsException("BFPONumber illegal value!!");
42 }
43 this.bFPONumber = bFPONumber;
44 }
45
46
47
48
49
50
51
52
53 public static BFPONumber of(final int bFPONumber)
54 {
55
56
57
58
59
60
61
62
63
64
65
66
67
68 return new BFPONumber(bFPONumber);
69 }
70
71
72
73
74
75
76
77
78 public static BFPONumber of(final String value)
79 {
80 return of(Integer.parseInt(value));
81 }
82
83
84
85
86
87
88
89 public int intValue()
90 {
91 return this.bFPONumber;
92 }
93
94
95
96
97
98
99
100 @Override
101 public String stringValue()
102 {
103 return Integer.toString(this.bFPONumber);
104 }
105
106
107
108
109
110
111
112
113 @Override
114 public int hashCode()
115 {
116 return Integer.hashCode(this.bFPONumber);
117 }
118
119
120
121
122
123
124
125
126
127 @Override
128 public boolean equals(final Object obj)
129 {
130 if (this == obj)
131 {
132 return true;
133 }
134 if (!(obj instanceof BFPONumber))
135 {
136 return false;
137 }
138 final BFPONumber other = (BFPONumber)obj;
139 return this.bFPONumber == other.bFPONumber;
140 }
141
142
143
144
145
146
147
148
149
150
151
152
153 @Override
154 public String toString()
155 {
156 final var builder = new StringBuilder(23);
157 builder.append("BFPONumber[bFPONumber=").append(this.bFPONumber).append(']');
158 return builder.toString();
159 }
160
161
162
163
164
165
166
167
168
169 @Override
170 public int compareTo(final BFPONumber obj)
171 {
172 Objects.requireNonNull(obj, "obj");
173 return Integer.compare(this.bFPONumber, obj.bFPONumber);
174 }
175
176 }
177