org.finnpic

Pic

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.
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Pic
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def ageAt(at: LocalDate): Period

  7. def ageInYearsAt(at: LocalDate): Int

  8. def ageInYearsNow()(implicit clock: Clock = Clock.systemDefaultZone()): Int

  9. def ageNow()(implicit clock: Clock = Clock.systemDefaultZone()): Period

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def birthDate: LocalDate

  12. 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
  13. 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
  14. 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
  15. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. def equals(obj: Any): Boolean

    Equals is true if the canonical string representation matches.

    Equals is true if the canonical string representation matches. Always false if the other object is not instance of Pic.

    obj

    another object.

    returns

    true if the string matches, false if not.

    Definition Classes
    Pic → AnyRef → Any
  18. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. val gender: Gender

    The Gender of the person whose PIC this is.

    The Gender of the person whose PIC this is. Currently this can be only Male or Female; this is a restriction which comes directly from the PIC specification.

    Examples:

    >>> Pic.fromStringU("070377-281V").gender
    Male
    
    >>> Pic.fromStringU("211114A664E").gender
    Female
  20. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

    The hashCode() function of Pic only delegates the call to value.

    The hashCode() function of Pic only delegates the call to value.

    Example:

    >>> Pic.fromStringU("070377-281V").hashCode == "070377-281V".hashCode
    true
    returns

    Definition Classes
    Pic → AnyRef → Any
  22. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  23. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  26. def personIsOfFinnishLegalAgeAt(at: LocalDate): Boolean

  27. def personIsOfFinnishLegalAgeNow()(implicit clock: Clock = Clock.systemDefaultZone()): Boolean

  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  29. 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
  30. 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
  31. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped