Skip to content

Commit

Permalink
equals hashcode
Browse files Browse the repository at this point in the history
  • Loading branch information
palfi committed Aug 16, 2021
1 parent 4f5a78f commit 5dedf1f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.time.LocalDate;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;

Expand Down Expand Up @@ -79,6 +80,26 @@ public Optional<LocalDate> getSenestMottattDato() {
return Optional.ofNullable(senestMottattDato);
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
var that = (AnnenpartUttakPeriode) o;
return samtidigUttak == that.samtidigUttak && flerbarnsdager == that.flerbarnsdager && utsettelse == that.utsettelse
&& oppholdsperiode == that.oppholdsperiode && innvilget == that.innvilget && Objects.equals(aktiviteter,
that.aktiviteter) && oppholdÅrsak == that.oppholdÅrsak && Objects.equals(senestMottattDato, that.senestMottattDato);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), aktiviteter, samtidigUttak, flerbarnsdager, utsettelse, oppholdsperiode, oppholdÅrsak,
innvilget, senestMottattDato);
}

public static class Builder {
private final AnnenpartUttakPeriode kladd;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static no.nav.foreldrepenger.regler.uttak.fastsetteperiode.grunnlag.PeriodeMedAvklartMorsAktivitet.Resultat.I_AKTIVITET;

import java.time.LocalDate;
import java.util.Objects;

import no.nav.foreldrepenger.regler.uttak.felles.grunnlag.LukketPeriode;

Expand All @@ -29,4 +30,21 @@ public enum Resultat {
IKKE_I_AKTIVITET_IKKE_DOKUMENTERT,
IKKE_I_AKTIVITET_DOKUMENTERT
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
var that = (PeriodeMedAvklartMorsAktivitet) o;
return resultat == that.resultat;
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), resultat);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public boolean equals(Object o) {
return true;
if (o == null || getClass() != o.getClass())
return false;
Periode periode = (Periode) o;
var periode = (Periode) o;
return Objects.equals(fom, periode.fom) && Objects.equals(tom, periode.tom);
}

Expand Down

0 comments on commit 5dedf1f

Please sign in to comment.