Class/Object

org.finnpic

Pic

Related Docs: object Pic | package finnpic

Permalink

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
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def ageAt(at: LocalDate): Period

    Permalink
  5. def ageInYearsAt(at: LocalDate): Int

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def birthDate: LocalDate

    Permalink
  8. val birthDay: Int

    Permalink

    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
  9. val birthMonth: Int

    Permalink

    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
  10. val birthYear: Int

    Permalink

    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
  11. def clone(): AnyRef

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

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

    Permalink

    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
  14. def finalize(): Unit

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

    Permalink

    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
  16. final def getClass(): Class[_]

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

    Permalink

    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
    Definition Classes
    Pic → AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

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

    Permalink
    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
  24. def toString(): String

    Permalink

    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
  25. val value: String

    Permalink

    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
  26. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped