public class IdNumber extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
idToken
The ID number token for this instance.
|
Constructor and Description |
---|
IdNumber(String idToken)
Creates an immutable ID number.
|
Modifier and Type | Method and Description |
---|---|
Optional<Period> |
age(Function<IdNumber,Optional<LocalDate>> birthDayFunction)
Retrieves the age of the person holding this ID number as it is defined for a given
birth day assertion.
|
Optional<LocalDate> |
birthday(Function<IdNumber,Optional<LocalDate>> birthDayFunction)
Retrieves the birth day of the person holding this ID number as it is defined for a given
birth day assertion.
|
static IdNumber |
forId(String idToken)
Creates a new ID number for a given token.
|
Optional<Gender> |
gender(Function<IdNumber,Optional<Gender>> genderFunction)
Retrieves the gender of the person holding this ID number as it is defined for a given
gender assertion.
|
String |
getIdToken()
Returns this ID number's token.
|
boolean |
isValid(Predicate<IdNumber> validityTest)
Checks if this ID number is valid for a given validity assertion.
|
protected final String idToken
public IdNumber(String idToken)
idToken
- The ID token to represent.public static IdNumber forId(String idToken)
idToken
- The token to represent.public String getIdToken()
public boolean isValid(Predicate<IdNumber> validityTest)
validityTest
- An implementation of an ID number's validity assertion.true
if this ID number is valid for the given assertion logic.public Optional<Gender> gender(Function<IdNumber,Optional<Gender>> genderFunction)
genderFunction
- An implementation of an ID number's gender assertion.public Optional<LocalDate> birthday(Function<IdNumber,Optional<LocalDate>> birthDayFunction)
birthDayFunction
- An implementation of an ID number's birth day assertion.public Optional<Period> age(Function<IdNumber,Optional<LocalDate>> birthDayFunction)
birthDayFunction
- An implementation of an ID number's birth day assertion.