Skip to content

Commit

Permalink
Deprecate Kjønn og fødselsår fra Fodselsnummer for fjerning
Browse files Browse the repository at this point in the history
Fra 1.1.2032 vil nye fødselsnummer være kjønnsnøytrale. Vi kommer derfor
til å fjerne kjønn fra Fodselsnummer.

Fra 1.1.2032 vil nye fødselsnummer tildeles etter ny algoritme. Tildeling av
nummere vil starte fra 999 og telle nedover. Individnummerene vil derfor
ikke lenger med sikkerhet kunne brukes til å si noe om århundre og derfor
ikke alder.

Mer info fra Skatteetaten:
https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/
  • Loading branch information
eivinhb committed Dec 13, 2024
1 parent b05bb24 commit f51f33b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
40 changes: 36 additions & 4 deletions src/main/java/no/bekk/bekkopen/person/Fodselsnummer.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,30 @@ public String getMonth() {
/**
* Returns the birthyear of the Fodselsnummer
*
* @return A String containing the year of birth.
* @return a String containg the year of birth represented by 2 (two) digits. Century is not included.
*/
public String getYear() {
return get2DigitBirthYear();
}

/**
* Returns the birthyear of the Fodselsnummer
*
* @return A String containing the year of birth represented by 4 (four) digits. Century is included.
* @deprecated For removal - After 1.1.2032 we cannot reliably conclude correct century anymore.
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
* replaced by {@link #getYear()}
*/
@Deprecated
public String getBirthYear() {
return getCentury() + get2DigitBirthYear();
}

/**
* @deprecated For removal - After 1.1.2032 we cannot reliably conclude correct century anymore.
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
*/
@Deprecated
String getCentury() {
String result = null;
int individnummerInt = Integer.parseInt(getIndividnummer());
Expand Down Expand Up @@ -152,9 +170,12 @@ public String getIndividnummer() {

/**
* Returns the digit that decides the gender - the 9th in the Fodselsnummer.
*
*
* @deprecated For removal - Gender will stop working after 1.1.2032
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
* @return The digit.
*/
@Deprecated
public int getGenderDigit() {
return getAt(8);
}
Expand All @@ -179,18 +200,24 @@ public int getChecksumDigit2() {

/**
* Returns true if the Fodselsnummer represents a man.
*
*
* @deprecated For removal - Gender will stop working after 1.1.2032
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
* @return true or false.
*/
@Deprecated
public boolean isMale() {
return getGenderDigit() % 2 != 0;
}

/**
* Returns true if the Fodselsnummer represents a woman.
*
*
* @deprecated For removal - Gender will stop working after 1.1.2032
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
* @return true or false.
*/
@Deprecated
public boolean isFemale() {
return !isMale();
}
Expand Down Expand Up @@ -264,6 +291,11 @@ private static int getThirdDigit(String fodselsnummer) {
return Integer.parseInt(fodselsnummer.substring(2, 3));
}

/**
* @deprecated For removal - Gender will stop working after 1.1.2032
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
*/
@Deprecated
public KJONN getKjonn() {
if (isFemale()) {
return KJONN.KVINNE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ private FodselsnummerCalculator() {
/**
* Returns a List with valid Fodselsnummer instances for a given Date and gender.
*
* @deprecated For removal - Gender will stop working after 1.1.2032
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
*
* @param date en dato
* @param kjonn kjønn
* @return liste med fødselsnummer
*/

@Deprecated
public static List<Fodselsnummer> getFodselsnummerForDateAndGender(Date date, KJONN kjonn) {
List<Fodselsnummer> result = getManyFodselsnummerForDate(date);
splitByGender(kjonn, result);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/no/bekk/bekkopen/person/KJONN.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
* #L%
*/

/**
* @deprecated For removal - Gender will stop working after 1.1.2032
* <a href="https://skatteetaten.github.io/folkeregisteret-api-dokumentasjon/nytt-fodselsnummer-fra-2032/">Nytt fødselsnummer fra 2032</a>
*/
@Deprecated
public enum KJONN {

MANN, KVINNE, BEGGE;
Expand Down

0 comments on commit f51f33b

Please sign in to comment.