Trait

org.finnpic

Parsable

Related Doc: package finnpic

Permalink

trait Parsable[T] extends AnyRef

Something that can be parsed from a String to a value object of type T.

T

The class of the value object which is the result of successful parsing.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Parsable
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def fromString(input: String): Either[String, T]

    Permalink

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

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

    See also fromStringUnsafe for cases where you are sure that the input is a valid T (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 String representation of T.

    returns

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

Concrete 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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def fromStringU(input: String): T

    Permalink

    A shorter alias for fromStringUnsafe.

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

    Examples:

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

    Permalink

    Create a T from an input String, throwing an scala.IllegalArgumentException if the input is not a valid String representation of T.

    Create a T from an input String, throwing an scala.IllegalArgumentException if the input is not a valid String representation of T.

    See also:

    • fromString for cases where you are not sure if the input is a valid T (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 String representation of T.

    returns

    a T object if the input is a valid String representation of T.

    Exceptions thrown

    scala.IllegalArgumentException if the input is not a valid String representation of T.

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

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

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

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

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

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

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

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped