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

implicit object MovieTableParser extends HeadedCSVTableParser[Movie] with MovieTableParser

An implicit object that extends the MovieTableParser trait to provide an implicit parser for converting CSV tables into structured data of type Table[Movie].

Functionality: - Handles parsing operations specific to movie-related datasets. - Operates in a forgiving mode, facilitating robust handling of parsing errors. - Utilizes an implicit RowParser to convert individual rows into Movie instances.

Designed to seamlessly integrate with libraries or frameworks requiring table parsing capabilities.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MovieTableParser
  2. MovieTableParser
  3. HeadedCSVTableParser
  4. StringTableParser
  5. AbstractTableParser
  6. TableParser
  7. TableBuilder
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type Input = String

    The input type, typically String or Strings.

    The input type, typically String or Strings.

    Definition Classes
    StringTableParser → TableParser
  2. type Row = Movie

    The row type.

    The row type.

    Definition Classes
    HeadedCSVTableParser → TableBuilder

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 builder(rows: Iterator[Movie], header: Header): Table[Movie]

    Default method to create a new table.

    Default method to create a new table. It does this by invoking either builderWithHeader or builderWithoutHeader, as appropriate.

    CONSIDER changing Iterable back to Iterator as it was at V1.0.13.

    rows

    the rows which will make up the table.

    header

    the Header, derived either from the program or the data.

    returns

    an instance of Table.

    Attributes
    protected
    Definition Classes
    HeadedCSVTableParser → TableBuilder
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def doParseRows(ts: Iterator[Input], header: Header, f: ((Input, Int)) => Try[Row])(implicit ev: Joinable[Input]): Try[Table[Movie]]

    Parses rows of input data into a table representation.

    Parses rows of input data into a table representation.

    This method utilizes an IndexedInputToRowsAggregator to transform an iterator of inputs into rows using the provided header and transformation function. It processes the input, materializes the resulting rows into a list, and constructs a table representation from the processed rows and header.

    ts

    an iterator of inputs to be parsed into rows.

    header

    the Header containing column metadata to guide the transformation process.

    f

    a transformation function that maps the Header to a function capable of transforming a tuple of input and its index into a Try[Row]. This function encapsulates row processing logic and error handling for each input element.

    ev

    an implicit evidence parameter ensuring the input type adheres to the Joinable type class, which defines how input elements can be combined or validated during processing.

    returns

    a Try containing a Table if the parsing is successful, or an error in case of failure.

    Definition Classes
    AbstractTableParser
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. val forgiving: Boolean

    If true, individual row failures are logged but do not cause the overall parse to fail.

    If true, individual row failures are logged but do not cause the overall parse to fail.

    Definition Classes
    MovieTableParser → TableBuilder
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. 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. The value is usually 1 but some types of CSV file have more than one header line. If maybeHeader exists, then this number is ignored.

    CONSIDER if this is really ignored when maybeHeader is defined, then we should eliminate such places where this value has an override of 0.

    Definition Classes
    TableParser
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. 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
    TableParser
  16. 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
    TableParser
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def parse(xs: Iterator[String], n: Int = headerRowsToRead): Try[Table[Movie]]

    Method to parse a table based on a sequence of Inputs.

    Method to parse a table based on a sequence of Inputs. NOTE: this is required so that we can invoke this method with an Iterator[String].

    xs

    the sequence of Inputs, one for each row

    n

    the number of rows to drop (length of the header)--defaults to 1.

    returns

    a Try[Table].

    Definition Classes
    StringTableParser → AbstractTableParser → TableParser
  21. def parseRows(ws: Iterator[String], header: Header): Try[Table[Movie]]

    Parses rows from an iterator of input strings (ws) using the provided header and row parsing logic.

    Parses rows from an iterator of input strings (ws) using the provided header and row parsing logic.

    This method utilizes the doParseRows function to process each row in the input iterator, applying the provided rowParser.parse function to convert input strings into logical rows, while using the header to guide parsing and interpretation of the input.

    ws

    an iterator over the input strings, where each string represents a row in the table.

    header

    the Header object that describes the expected structure of the table (e.g., column names).

    returns

    a Try of the parsed Table object. On success, it contains the resulting table; on failure, it contains the parsing error.

    Definition Classes
    StringTableParser → AbstractTableParser
  22. val predicate: (Try[Row]) => Boolean

    Predicate to filter rows.

    Predicate to filter rows. Defaults to including all rows.

    Attributes
    protected
    Definition Classes
    TableBuilder
  23. val rowParser: RowParser[Movie, String]

    Method to define a row parser.

    Method to define a row parser.

    returns

    a RowParser[Row, Input].

    Definition Classes
    HeadedCSVTableParser → TableParser
  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. 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 MovieTableParser

Inherited from HeadedCSVTableParser[Movie]

Inherited from StringTableParser[Table[Movie]]

Inherited from TableParser[Table[Movie]]

Inherited from TableBuilder[Table[Movie]]

Inherited from AnyRef

Inherited from Any

Ungrouped