+ public static class BirthDate implements Fingerprintable {
+
+ private final Optional<Integer> year;
+ private final Optional<Integer> month;
+ private final Optional<Integer> day;
+
+ public BirthDate() {
+ this(Optional.<Integer>absent(), Optional.<Integer>absent(), Optional.<Integer>absent());
+ }
+
+ public BirthDate(Optional<Integer> year, Optional<Integer> month, Optional<Integer> day) {
+ this.year = year;
+ this.month = month;
+ this.day = day;
+ }
+
+ public Optional<Integer> getYear() {
+ return year;
+ }
+
+ public Optional<Integer> getMonth() {
+ return month;
+ }
+
+ public Optional<Integer> getDay() {
+ return day;
+ }
+
+ @Override
+ public String getFingerprint() {
+ Hasher hash = Hashing.sha256().newHasher();
+ hash.putString("Birthdate(");
+ if (year.isPresent()) {
+ hash.putString("Year(").putInt(year.get()).putString(")");
+ }
+ if (month.isPresent()) {
+ hash.putString("Month(").putInt(month.get()).putString(")");
+ }
+ if (day.isPresent()) {
+ hash.putString("Day(").putInt(day.get()).putString(")");
+ }
+ hash.putString(")");
+ return hash.hash().toString();
+ }
+
+ }
+