class Pic extends AnyRef
PIC = Personal Identity Code, "henkilotunnus" in Finnish.
See https://vrk.fi/en/personal-identity-code1 for specs.
The constructor is private on purpose, so that Pics can only be created via the companion object (the so called "smart constructor" pattern). This prevents instances which are in an illegal state. Every Pic object can thus be treated as a valid Pic.
See the companion object for how to create instances of Pic.
Some examples of Pic creation:
>>> Pic("070377-281V") Right(070377-281V) >>> Pic("070377-281") Left(Invalid PIC: '070377-281'. PIC should have 11 characters, but was 10 characters.) >>> Pic("070377-2818") Left(Invalid PIC: '070377-2818'. The control character ('8') is wrong: it should be 'V'.) >>> Pic.fromStringUnsafe("070377-281V") 070377-281V // Pic.fromStringU is just a shorter alias for Pic.fromStringUnsafe. >>> Pic.fromStringU("070377-281V") 070377-281V // If you give Pic.fromStringUnsafe (or Pic.fromStringU) an invalid PIC, they throw an IllegalArgumentException.
- Alphabetic
- By Inheritance
- Pic
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ageAt(at: LocalDate): Period
- def ageInYearsAt(at: LocalDate): Int
- def ageInYearsNow()(implicit clock: Clock = Clock.systemDefaultZone()): Int
- def ageNow()(implicit clock: Clock = Clock.systemDefaultZone()): Period
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def birthDate: LocalDate
- val birthDay: Int
The day of month of the birth of the person whose PIC this is.
The day of month of the birth of the person whose PIC this is. It is not a typo that this method is called 'birthDay', not 'birthday'. They are different concepts: this contains only the day of month, whereas the concept of 'birthday' includes the whole date.
Examples:
>>> Pic.fromStringU("070377-281V").birthDay 7 >>> Pic.fromStringU("211114A664E").birthDay 21
- val birthMonth: Int
The birth month of the person whose PIC this is.
The birth month of the person whose PIC this is. 1-based representation, so January is 1 and December is 12.
Examples:
>>> Pic.fromStringU("070377-281V").birthMonth 3 >>> Pic.fromStringU("211114A664E").birthMonth 11
- val birthYear: Int
The birth year of the person whose PIC this is.
The birth year of the person whose PIC this is.
Examples:
>>> Pic.fromStringU("070377-281V").birthYear 1977 >>> Pic.fromStringU("211114A664E").birthYear 2014
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(obj: Any): Boolean
Equals is true if the canonical string representation matches.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- val gender: Gender
The Gender of the person whose PIC this is.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
The hashCode() function of Pic only delegates the call to value.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def personIsOfFinnishLegalAgeAt(at: LocalDate): Boolean
- def personIsOfFinnishLegalAgeNow()(implicit clock: Clock = Clock.systemDefaultZone()): Boolean
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
The canonical string representation of the PIC.
The canonical string representation of the PIC. Usually the same String which was used to create this object.
Example:
>>> Pic.fromStringU("070377-281V").toString 070377-281V
- returns
the canonical string representation of the PIC.
- Definition Classes
- Pic → AnyRef → Any
- val value: String
The PIC String used to create this Pic object itself, trimmed and in uppercase.
The PIC String used to create this Pic object itself, trimmed and in uppercase.
Examples:
>>> Pic.fromStringU("070377-281V").value 070377-281V >>> Pic.fromStringU("211114a664e").value 211114A664E
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()