|
18 | 18 | import static java.util.Collections.*;
|
19 | 19 | import static org.assertj.core.api.Assertions.*;
|
20 | 20 |
|
21 |
| -import lombok.AllArgsConstructor; |
22 |
| -import lombok.Data; |
23 |
| -import lombok.Value; |
24 |
| -import lombok.With; |
25 |
| - |
26 | 21 | import org.assertj.core.api.SoftAssertions;
|
27 | 22 | import org.junit.jupiter.api.Test;
|
28 | 23 | import org.junit.jupiter.api.extension.ExtendWith;
|
@@ -300,45 +295,307 @@ private static Manual createManual() {
|
300 | 295 | "Accelerates to 99% of light speed. Destroys almost everything. See https://what-if.xkcd.com/1/");
|
301 | 296 | }
|
302 | 297 |
|
303 |
| - @Value |
304 |
| - @With |
305 |
| - static class LegoSet { |
| 298 | + static final class LegoSet { |
| 299 | + |
| 300 | + @Id private final Long id; |
| 301 | + private final String name; |
| 302 | + private final Manual manual; |
| 303 | + private final Author author; |
| 304 | + |
| 305 | + public LegoSet(Long id, String name, Manual manual, Author author) { |
| 306 | + this.id = id; |
| 307 | + this.name = name; |
| 308 | + this.manual = manual; |
| 309 | + this.author = author; |
| 310 | + } |
| 311 | + |
| 312 | + public Long getId() { |
| 313 | + return this.id; |
| 314 | + } |
| 315 | + |
| 316 | + public String getName() { |
| 317 | + return this.name; |
| 318 | + } |
| 319 | + |
| 320 | + public Manual getManual() { |
| 321 | + return this.manual; |
| 322 | + } |
306 | 323 |
|
307 |
| - @Id Long id; |
308 |
| - String name; |
309 |
| - Manual manual; |
310 |
| - Author author; |
| 324 | + public Author getAuthor() { |
| 325 | + return this.author; |
| 326 | + } |
| 327 | + |
| 328 | + public boolean equals(final Object o) { |
| 329 | + if (o == this) |
| 330 | + return true; |
| 331 | + if (!(o instanceof LegoSet)) |
| 332 | + return false; |
| 333 | + final LegoSet other = (LegoSet) o; |
| 334 | + final Object this$id = this.getId(); |
| 335 | + final Object other$id = other.getId(); |
| 336 | + if (this$id == null ? other$id != null : !this$id.equals(other$id)) |
| 337 | + return false; |
| 338 | + final Object this$name = this.getName(); |
| 339 | + final Object other$name = other.getName(); |
| 340 | + if (this$name == null ? other$name != null : !this$name.equals(other$name)) |
| 341 | + return false; |
| 342 | + final Object this$manual = this.getManual(); |
| 343 | + final Object other$manual = other.getManual(); |
| 344 | + if (this$manual == null ? other$manual != null : !this$manual.equals(other$manual)) |
| 345 | + return false; |
| 346 | + final Object this$author = this.getAuthor(); |
| 347 | + final Object other$author = other.getAuthor(); |
| 348 | + if (this$author == null ? other$author != null : !this$author.equals(other$author)) |
| 349 | + return false; |
| 350 | + return true; |
| 351 | + } |
| 352 | + |
| 353 | + public int hashCode() { |
| 354 | + final int PRIME = 59; |
| 355 | + int result = 1; |
| 356 | + final Object $id = this.getId(); |
| 357 | + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); |
| 358 | + final Object $name = this.getName(); |
| 359 | + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); |
| 360 | + final Object $manual = this.getManual(); |
| 361 | + result = result * PRIME + ($manual == null ? 43 : $manual.hashCode()); |
| 362 | + final Object $author = this.getAuthor(); |
| 363 | + result = result * PRIME + ($author == null ? 43 : $author.hashCode()); |
| 364 | + return result; |
| 365 | + } |
| 366 | + |
| 367 | + public String toString() { |
| 368 | + return "ImmutableAggregateTemplateHsqlIntegrationTests.LegoSet(id=" + this.getId() + ", name=" + this.getName() |
| 369 | + + ", manual=" + this.getManual() + ", author=" + this.getAuthor() + ")"; |
| 370 | + } |
| 371 | + |
| 372 | + public LegoSet withId(Long id) { |
| 373 | + return this.id == id ? this : new LegoSet(id, this.name, this.manual, this.author); |
| 374 | + } |
| 375 | + |
| 376 | + public LegoSet withName(String name) { |
| 377 | + return this.name == name ? this : new LegoSet(this.id, name, this.manual, this.author); |
| 378 | + } |
| 379 | + |
| 380 | + public LegoSet withManual(Manual manual) { |
| 381 | + return this.manual == manual ? this : new LegoSet(this.id, this.name, manual, this.author); |
| 382 | + } |
| 383 | + |
| 384 | + public LegoSet withAuthor(Author author) { |
| 385 | + return this.author == author ? this : new LegoSet(this.id, this.name, this.manual, author); |
| 386 | + } |
311 | 387 | }
|
312 | 388 |
|
313 |
| - @Value |
314 |
| - @With |
315 |
| - static class Manual { |
| 389 | + static final class Manual { |
| 390 | + |
| 391 | + @Id private final Long id; |
| 392 | + private final String content; |
| 393 | + |
| 394 | + public Manual(Long id, String content) { |
| 395 | + this.id = id; |
| 396 | + this.content = content; |
| 397 | + } |
| 398 | + |
| 399 | + public Long getId() { |
| 400 | + return this.id; |
| 401 | + } |
| 402 | + |
| 403 | + public String getContent() { |
| 404 | + return this.content; |
| 405 | + } |
| 406 | + |
| 407 | + public boolean equals(final Object o) { |
| 408 | + if (o == this) |
| 409 | + return true; |
| 410 | + if (!(o instanceof Manual)) |
| 411 | + return false; |
| 412 | + final Manual other = (Manual) o; |
| 413 | + final Object this$id = this.getId(); |
| 414 | + final Object other$id = other.getId(); |
| 415 | + if (this$id == null ? other$id != null : !this$id.equals(other$id)) |
| 416 | + return false; |
| 417 | + final Object this$content = this.getContent(); |
| 418 | + final Object other$content = other.getContent(); |
| 419 | + if (this$content == null ? other$content != null : !this$content.equals(other$content)) |
| 420 | + return false; |
| 421 | + return true; |
| 422 | + } |
| 423 | + |
| 424 | + public int hashCode() { |
| 425 | + final int PRIME = 59; |
| 426 | + int result = 1; |
| 427 | + final Object $id = this.getId(); |
| 428 | + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); |
| 429 | + final Object $content = this.getContent(); |
| 430 | + result = result * PRIME + ($content == null ? 43 : $content.hashCode()); |
| 431 | + return result; |
| 432 | + } |
| 433 | + |
| 434 | + public String toString() { |
| 435 | + return "ImmutableAggregateTemplateHsqlIntegrationTests.Manual(id=" + this.getId() + ", content=" |
| 436 | + + this.getContent() + ")"; |
| 437 | + } |
316 | 438 |
|
317 |
| - @Id Long id; |
318 |
| - String content; |
| 439 | + public Manual withId(Long id) { |
| 440 | + return this.id == id ? this : new Manual(id, this.content); |
| 441 | + } |
| 442 | + |
| 443 | + public Manual withContent(String content) { |
| 444 | + return this.content == content ? this : new Manual(this.id, content); |
| 445 | + } |
319 | 446 | }
|
320 | 447 |
|
321 |
| - @Value |
322 |
| - @With |
323 |
| - static class Author { |
| 448 | + static final class Author { |
324 | 449 |
|
325 |
| - @Id Long id; |
326 |
| - String name; |
| 450 | + @Id private final Long id; |
| 451 | + private final String name; |
| 452 | + |
| 453 | + public Author(Long id, String name) { |
| 454 | + this.id = id; |
| 455 | + this.name = name; |
| 456 | + } |
| 457 | + |
| 458 | + public Long getId() { |
| 459 | + return this.id; |
| 460 | + } |
| 461 | + |
| 462 | + public String getName() { |
| 463 | + return this.name; |
| 464 | + } |
| 465 | + |
| 466 | + public boolean equals(final Object o) { |
| 467 | + if (o == this) |
| 468 | + return true; |
| 469 | + if (!(o instanceof Author)) |
| 470 | + return false; |
| 471 | + final Author other = (Author) o; |
| 472 | + final Object this$id = this.getId(); |
| 473 | + final Object other$id = other.getId(); |
| 474 | + if (this$id == null ? other$id != null : !this$id.equals(other$id)) |
| 475 | + return false; |
| 476 | + final Object this$name = this.getName(); |
| 477 | + final Object other$name = other.getName(); |
| 478 | + if (this$name == null ? other$name != null : !this$name.equals(other$name)) |
| 479 | + return false; |
| 480 | + return true; |
| 481 | + } |
| 482 | + |
| 483 | + public int hashCode() { |
| 484 | + final int PRIME = 59; |
| 485 | + int result = 1; |
| 486 | + final Object $id = this.getId(); |
| 487 | + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); |
| 488 | + final Object $name = this.getName(); |
| 489 | + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); |
| 490 | + return result; |
| 491 | + } |
| 492 | + |
| 493 | + public String toString() { |
| 494 | + return "ImmutableAggregateTemplateHsqlIntegrationTests.Author(id=" + this.getId() + ", name=" + this.getName() |
| 495 | + + ")"; |
| 496 | + } |
| 497 | + |
| 498 | + public Author withId(Long id) { |
| 499 | + return this.id == id ? this : new Author(id, this.name); |
| 500 | + } |
| 501 | + |
| 502 | + public Author withName(String name) { |
| 503 | + return this.name == name ? this : new Author(this.id, name); |
| 504 | + } |
327 | 505 | }
|
328 | 506 |
|
329 |
| - @Data |
330 |
| - @AllArgsConstructor |
331 | 507 | static class Root {
|
332 | 508 | @Id private Long id;
|
333 | 509 | private String name;
|
334 | 510 | private NonRoot reference;
|
| 511 | + |
| 512 | + public Root(Long id, String name, NonRoot reference) { |
| 513 | + this.id = id; |
| 514 | + this.name = name; |
| 515 | + this.reference = reference; |
| 516 | + } |
| 517 | + |
| 518 | + public Long getId() { |
| 519 | + return this.id; |
| 520 | + } |
| 521 | + |
| 522 | + public String getName() { |
| 523 | + return this.name; |
| 524 | + } |
| 525 | + |
| 526 | + public NonRoot getReference() { |
| 527 | + return this.reference; |
| 528 | + } |
| 529 | + |
| 530 | + public void setId(Long id) { |
| 531 | + this.id = id; |
| 532 | + } |
| 533 | + |
| 534 | + public void setName(String name) { |
| 535 | + this.name = name; |
| 536 | + } |
| 537 | + |
| 538 | + public void setReference(NonRoot reference) { |
| 539 | + this.reference = reference; |
| 540 | + } |
335 | 541 | }
|
336 | 542 |
|
337 |
| - @Value |
338 |
| - @With |
339 |
| - static class NonRoot { |
340 |
| - @Id Long id; |
341 |
| - String name; |
| 543 | + static final class NonRoot { |
| 544 | + @Id private final Long id; |
| 545 | + private final String name; |
| 546 | + |
| 547 | + public NonRoot(Long id, String name) { |
| 548 | + this.id = id; |
| 549 | + this.name = name; |
| 550 | + } |
| 551 | + |
| 552 | + public Long getId() { |
| 553 | + return this.id; |
| 554 | + } |
| 555 | + |
| 556 | + public String getName() { |
| 557 | + return this.name; |
| 558 | + } |
| 559 | + |
| 560 | + public boolean equals(final Object o) { |
| 561 | + if (o == this) |
| 562 | + return true; |
| 563 | + if (!(o instanceof NonRoot)) |
| 564 | + return false; |
| 565 | + final NonRoot other = (NonRoot) o; |
| 566 | + final Object this$id = this.getId(); |
| 567 | + final Object other$id = other.getId(); |
| 568 | + if (this$id == null ? other$id != null : !this$id.equals(other$id)) |
| 569 | + return false; |
| 570 | + final Object this$name = this.getName(); |
| 571 | + final Object other$name = other.getName(); |
| 572 | + if (this$name == null ? other$name != null : !this$name.equals(other$name)) |
| 573 | + return false; |
| 574 | + return true; |
| 575 | + } |
| 576 | + |
| 577 | + public int hashCode() { |
| 578 | + final int PRIME = 59; |
| 579 | + int result = 1; |
| 580 | + final Object $id = this.getId(); |
| 581 | + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); |
| 582 | + final Object $name = this.getName(); |
| 583 | + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); |
| 584 | + return result; |
| 585 | + } |
| 586 | + |
| 587 | + public String toString() { |
| 588 | + return "ImmutableAggregateTemplateHsqlIntegrationTests.NonRoot(id=" + this.getId() + ", name=" + this.getName() |
| 589 | + + ")"; |
| 590 | + } |
| 591 | + |
| 592 | + public NonRoot withId(Long id) { |
| 593 | + return this.id == id ? this : new NonRoot(id, this.name); |
| 594 | + } |
| 595 | + |
| 596 | + public NonRoot withName(String name) { |
| 597 | + return this.name == name ? this : new NonRoot(this.id, name); |
| 598 | + } |
342 | 599 | }
|
343 | 600 |
|
344 | 601 | static class WithCopyConstructor {
|
|
0 commit comments