Packages

  • package root
    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package phasmidsoftware
    Definition Classes
    com
  • package tableparser
    Definition Classes
    phasmidsoftware
  • package core
    Definition Classes
    tableparser
  • package examples
    Definition Classes
    core
  • object Movie extends CellParsers with CsvGenerators with CsvRenderers with Serializable

    The Movie object provides functionality for generating CSV representations of Movie instances.

    The Movie object provides functionality for generating CSV representations of Movie instances. It utilizes the CsvGenerators framework to define and create CSV generators for the various fields and nested components of the Movie class, as well as the Movie class itself.

    Overview

    The Movie object contains the following key elements:

    - **csvGenerators**: An instance of CsvGenerators that provides predefined CSV generators for standard data types such as Boolean, Int, Double, and String. It serves as the foundation for custom CSV generators.

    - **createMovieCvsGenerator**: A method that constructs a CsvGenerator specific to the Movie class. This generator supports serialization of Movie instances into CSV format, accounting for nested data structures and optional values.

    Dependencies

    This object imports the following from com.phasmidsoftware.tableparser.core.render.CsvGenerators: - Predefined implicit CSV generators for basic data types and utilities for creating additional generators.

    Key Method Descriptions

    - createMovieCvsGenerator:

    • Constructs and returns a CsvGenerator[Movie], facilitating the generation of CSV rows for Movie objects.
    • Custom generators are defined for various components of the Movie class, including:
      • StringList: A sequence of strings.
      • Option[Double]: Optional Double values.
      • Option[Int]: Optional Int values.
      • Option[String]: Optional String values.
      • Format: A case class representing the format of a Movie.
      • Production: A case class holding details about a Movie's production.
      • Rating: Represents a case class for the rating information of a Movie.
      • Reviews: A case class containing detailed review information.
      • Name: A case class for principal names.
      • Principal: A case class for individuals associated with a Movie.
      • Option[Principal]: An optional Principal.
      • AttributeSet: A case class for sets of attributes such as genres or plot keywords.
    • The resulting CsvGenerator[Movie] aggregates these component-level generators to enable CSV serialization of the entire Movie object.

    Usage

    To generate a CSV representation of Movie objects: 1. Invoke the createMovieCvsGenerator method within this object to obtain the appropriate CsvGenerator[Movie]. 2. Use the generated CsvGenerator to serialize a Movie instance into a CSV format.

    This utility is especially useful for exporting Movie data into a structured format, such as for persistence or integration with external systems that require CSV data.

    Example

    val movieCsvGenerator = Movie.createMovieCvsGenerator
    val movie = Movie("Inception", Format(...), Production(...), Reviews(...), ...)
    val csvRepresentation = movieCsvGenerator.generate(movie)
    Definition Classes
    examples
    Annotations
    @deprecated
    Deprecated

    (Since version 1.7.0) Example code: it moves out of the library, into the tests, in 2.0.0

  • MovieConfig
  • MovieRowProcessor
  • MovieTableParser

trait MovieRowProcessor extends StringRowProcessor[Movie]

The MovieRowProcessor trait provides a concrete implementation for processing rows of raw input (as Strings) representing Movie objects. This trait extends the StringRowProcessor tailored for Movie rows, deducing String as the input type and Movie as the row type.

Specifically, this trait: - Adopts a fault-tolerant approach to parsing by setting forgiving = true, enabling the processor to recover from minor parsing errors where possible. - Utilizes an implicit RowParser[Movie, String] to handle the actual parsing logic for individual rows. - Optionally relies on a Header for structured row processing. If a fixed header is not provided via maybeHeader, additional rows can be consumed to dynamically determine the header. - Sets the default number of header rows to read as 1 (headerRowsToRead).

This processor is an integral part of the parsing workflow for Movie data parsed from input sources such as files or streams.

Key Type Members and Fields: - Row: Alias for Movie as the row type this processor handles. - maybeHeader: Optionally allows for a pre-determined table header for consistent column names. - headerRowsToRead: Specifies the number of rows to consume when detecting a dynamic header. - forgiving: Configures fault-tolerance for processing, set to true by default. - rowParser: An implicit instance of RowParser

Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MovieRowProcessor
  2. StringRowProcessor
  3. AbstractRowProcessor
  4. RowProcessor
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type Input = String

    The input type, typically String.

    The input type, typically String.

    Definition Classes
    StringRowProcessor → RowProcessor

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. val forgiving: Boolean

    Method to determine how errors are handled.

    Method to determine how errors are handled.

    returns

    true if individual errors are logged but do not cause parsing to fail.

    Definition Classes
    MovieRowProcessor → RowProcessor
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. val headerRowsToRead: Int

    This indicates the number of header rows which must be read from the input.

    This indicates the number of header rows which must be read from the input. If maybeHeader exists, then this property is ignored.

    Definition Classes
    RowProcessor
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. val maybeHeader: Option[Header]

    This variable determines if there is a programmed, i.e., fixed, header for the parser.

    This variable determines if there is a programmed, i.e., fixed, header for the parser. If its value is None, it signifies that we must look to the first line(s) of data for an appropriate header.

    Attributes
    protected
    Definition Classes
    RowProcessor
  14. val multiline: Boolean

    Value to determine whether it is acceptable to have a quoted string span more than one line.

    Value to determine whether it is acceptable to have a quoted string span more than one line.

    returns

    true if quoted strings may span more than one line.

    Attributes
    protected
    Definition Classes
    RowProcessor
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. val predicate: (Try[Movie]) => Boolean

    Function to determine whether or not a row should be included in the table.

    Function to determine whether or not a row should be included in the table. Typically used for random sampling.

    Attributes
    protected
    Definition Classes
    RowProcessor
  19. def process(xs: Iterator[String], n: Int)(implicit ev: Joinable[String]): Iterator[Movie]

    Processes an iterator of input rows with an optional header and parses them into rows.

    Processes an iterator of input rows with an optional header and parses them into rows.

    NOTE this will not work as required because it will still have to collect all of the individual elements inside a Try at some point. That defeats the purpose of just being able to iterate.

    Depending on the presence of a fixed header and the number of rows to drop (n): - If a fixed header is available, the processing starts after dropping the first n rows. - If no fixed header is available but n > 0, the first n rows are extracted and used to parse the header, and subsequent rows are processed accordingly. - If no fixed header is available and n <= 0, an error is returned indicating a logic issue.

    This method heavily relies on implicit evidence (Joinable[Input]) to ensure the input type adheres to the necessary constraints for the transformation and joining of rows.

    xs

    an iterator of inputs, where each element corresponds to a row of input data.

    n

    the number of initial rows to ignore (e.g., when rows are part of the header).

    ev

    an implicit evidence parameter ensuring the input type adheres to the Joinable type class, which provides methods to combine or validate input elements during processing.

    returns

    a Try containing an iterator of parsed Row objects if the parsing succeeds, or a failure if any step of the process encounters an error (e.g., invalid header or processing logic).

    Definition Classes
    StringRowProcessor → AbstractRowProcessor
  20. val rowParser: RowParser[Movie, String]

    Method to define a row parser.

    Method to define a row parser.

    returns

    a RowParser[Row, Input].

    Definition Classes
    StringRowProcessor → RowProcessor
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from StringRowProcessor[Movie]

Inherited from AbstractRowProcessor[Movie]

Inherited from RowProcessor[Movie]

Inherited from AnyRef

Inherited from Any

Ungrouped