Skip to content

Commit

Permalink
Override toString method
Browse files Browse the repository at this point in the history
  • Loading branch information
ullenius authored and Johannestegner committed Jun 26, 2020
1 parent 32a0101 commit 43e6064
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/dev/personnummer/Personnummer.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public Personnummer(String personnummer) throws PersonnummerException {
this(personnummer, new Options());
}

@Override
public String toString() {
return format();
}

/**
* Format the personal identity number into a valid string (YYMMDD-/+XXXX)
* If longFormat is true, it will include the century (YYYYMMDD-/+XXXX)
Expand Down Expand Up @@ -234,6 +239,5 @@ public boolean equals(Object obj) {
return Objects.equals(format(true), other.format(true));
}



}

0 comments on commit 43e6064

Please sign in to comment.