Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Kjønn og fødselsår fra Fodselsnummer for fjerning #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading