org.finnpic

Pic

object Pic

Contains the factory methods for creating objects of class Pic. Follows the "smart constructor" pattern, familiar from Haskell.

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 apply(input: String): Either[String, Pic]

    Create a Pic from an input String, see fromString(input:String):Either*.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

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

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. val finnishLegalAge: Int

  13. def fromString(input: String): Either[String, Pic]

    Create a Pic from an input String, returning an scala.util.Either.

    Create a Pic from an input String, returning an scala.util.Either.

    See also fromStringUnsafe for cases where you are sure that the input is a valid PIC (or you are willing to handle exceptions).

    Examples:

    >>> 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'.)
    input

    a valid Personal Identity Code as a String.

    returns

    Left(String) if the given String is not a valid PIC, return a scala.util.Left containing an error message. Right(Pic) if the given String is a valid PIC, return a scala.util.Right containing the Pic object.

  14. def fromStringU(input: String): Pic

    A shorter alias for Pic.fromStringUnsafe.

    A shorter alias for Pic.fromStringUnsafe. See the documentation for that function.

    Examples:

    >>> Pic.fromStringU("070377-281V")
    070377-281V
    
    >>> // Pic.fromStringU("foo") would throw an IllegalArgumentException.
  15. def fromStringUnsafe(input: String): Pic

    Create a Pic from an input String, throwing an scala.IllegalArgumentException if the input is not a valid PIC.

    Create a Pic from an input String, throwing an scala.IllegalArgumentException if the input is not a valid PIC.

    See also:

    • fromString for cases where you are not sure if the input is a valid PIC (for example, the input comes from a user), which returns an Either for you to handle.
    • fromStringU for a shorter named alias of this function.

    Examples:

    >>> Pic.fromStringUnsafe("070377-281V")
    070377-281V
    
    >>> // Pic.fromStringUnsafe("foo") would throw an IllegalArgumentException.
    input

    a valid Personal Identity Code as a String.

    returns

    a Pic object if the input is a valid PIC.

    Exceptions thrown
    scala.IllegalArgumentException

    if the input is not a valid PIC.

  16. final def getClass(): Class[_]

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

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

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

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

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

    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. def toString(): String

    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped