Commit 2cbb75b5 authored by Trisha Gee's avatar Trisha Gee
Browse files

[appB] Compact constructor

parent 099a1ad5
Loading
Loading
Loading
Loading
+1 −4
Changes for src/main/java/appB/CustomerWithValidation.java: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
package appB;

public record CustomerWithValidation(int id, String name) {
  public CustomerWithValidation(int id, String name) {
  public CustomerWithValidation {
    if (id < 0) {
      throw new ValidationException();
    }
    this.id = id;
    this.name = name;
  }

  public int id() {
    checkEverythingIsOk();
    return id;
  }