tabulate

CellDecoder

trait CellDecoder[A] extends AnyRef

Decodes CSV cells into usable types.

By itself, an instance of CellDecoder is not terribly interesting. It becomes useful when combined with RowDecoder, which relies on any implicit CellDecoder it has in scope to parse entire rows.

If, for example, you need to parse CSV data that contains ISO 8601 formatted dates, you can't immediately call CsvInput.reader with a type argument of List[Date]: dates are not supported natively (because they can be serialised in so many different ways).

This can be remedied simply by writing the following:

implicit val dateDecoder = CellDecoder(s => DecodeResult(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse(s)))

See the companion object for default implementations and construction methods.

See also

Tutorial

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CellDecoder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def decode(s: String): DecodeResult[A]

    Turns the content of a CSV cell into an A.

    Turns the content of a CSV cell into an A.

    Annotations
    @noop()

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

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def decode(ss: Seq[String], index: Int): DecodeResult[A]

    Turns the content of the specified cell into an A.

    Turns the content of the specified cell into an A.

    The purpose of this method is to protect against index out of bound exceptions. Should the specified index not exist, a DecodeResult.DecodeFailure instance will be returned.

    Annotations
    @noop()
  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. def flatMap[B](f: (A) ⇒ CellDecoder[B]): CellDecoder[B]

    Annotations
    @noop()
  13. final def getClass(): Class[_]

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

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

    Definition Classes
    Any
  16. def map[B](f: (A) ⇒ B): CellDecoder[B]

    Turns an instance of CellDecoder[A] into one of CellDecoder[B].

    Turns an instance of CellDecoder[A] into one of CellDecoder[B].

    This allows developers to adapt existing instances of CellDecoder rather than write one from scratch.

    Annotations
    @noop()
  17. final def ne(arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    AnyRef
  21. def toString(): String

    Definition Classes
    AnyRef → Any
  22. def unsafeDecode(ss: Seq[String], index: Int): A

    Annotations
    @noop()
  23. def unsafeDecode(s: String): A

    Annotations
    @noop()
  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