|
1 | 1 | package it.aboutbits.springboot.toolbox.type; |
2 | 2 |
|
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; |
3 | 4 | import org.jspecify.annotations.NullMarked; |
4 | 5 |
|
5 | 6 | import java.math.BigDecimal; |
@@ -275,42 +276,52 @@ public short shortValue() { |
275 | 276 | return (short) intValue(); |
276 | 277 | } |
277 | 278 |
|
| 279 | + @JsonIgnore |
278 | 280 | public boolean isZero() { |
279 | 281 | return this.value().compareTo(BigDecimal.ZERO) == 0; |
280 | 282 | } |
281 | 283 |
|
| 284 | + @JsonIgnore |
282 | 285 | public boolean isNegative() { |
283 | 286 | return this.value().compareTo(BigDecimal.ZERO) < 0; |
284 | 287 | } |
285 | 288 |
|
| 289 | + @JsonIgnore |
286 | 290 | public boolean isPositive() { |
287 | 291 | return this.value().compareTo(BigDecimal.ZERO) > 0; |
288 | 292 | } |
289 | 293 |
|
| 294 | + @JsonIgnore |
290 | 295 | public boolean isPositiveOrZero() { |
291 | 296 | return this.value().compareTo(BigDecimal.ZERO) >= 0; |
292 | 297 | } |
293 | 298 |
|
| 299 | + @JsonIgnore |
294 | 300 | public boolean isNegativeOrZero() { |
295 | 301 | return this.value().compareTo(BigDecimal.ZERO) <= 0; |
296 | 302 | } |
297 | 303 |
|
| 304 | + @JsonIgnore |
298 | 305 | public boolean isEqual(ScaledBigDecimal other) { |
299 | 306 | return this.compareTo(other) == 0; |
300 | 307 | } |
301 | 308 |
|
| 309 | + @JsonIgnore |
302 | 310 | public boolean isBiggerThan(ScaledBigDecimal other) { |
303 | 311 | return this.compareTo(other) > 0; |
304 | 312 | } |
305 | 313 |
|
| 314 | + @JsonIgnore |
306 | 315 | public boolean isEqualOrBiggerThan(ScaledBigDecimal other) { |
307 | 316 | return this.compareTo(other) >= 0; |
308 | 317 | } |
309 | 318 |
|
| 319 | + @JsonIgnore |
310 | 320 | public boolean isSmallerThan(ScaledBigDecimal other) { |
311 | 321 | return this.compareTo(other) < 0; |
312 | 322 | } |
313 | 323 |
|
| 324 | + @JsonIgnore |
314 | 325 | public boolean isEqualOrSmallerThan(ScaledBigDecimal other) { |
315 | 326 | return this.compareTo(other) <= 0; |
316 | 327 | } |
|
0 commit comments