package parse

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. parse
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. abstract class AbstractRowProcessor[Row] extends RowProcessor[Row]

    Abstract class representing a row processor for handling input rows and parsing them into a specified row type.

    Abstract class representing a row processor for handling input rows and parsing them into a specified row type.

    This class extends the RowProcessor type class and provides additional methods for processing iterators of input rows based on headers and transformation functions. It relies on the implicit evidence of the Joinable type class to define behavior for handling the input type.

    Row

    the type of rows output by this processor.

  2. abstract class AbstractTableParser[Table] extends TableParser[Table]

    Abstract base class for implementations of TableParser[T].

    Abstract base class for implementations of TableParser[T]. NOTE: that Table is a parametric type and does NOT refer to the type Table defined elsewhere.

    CONSIDER making this a trait

    Table

    the (parametric) Table type.

  3. case class AttributeSet(xs: StringList) extends Product with Serializable

    This class is used for the situation where a column in a table actually contains a set of attributes, typically separated by "," and possibly bracketed by "{}".

    This class is used for the situation where a column in a table actually contains a set of attributes, typically separated by "," and possibly bracketed by "{}". CONSIDER allowing "|" as a separator (as described previously in the documentation here).

    xs

    the attribute values.

  4. case class BlankException(e: Throwable = null) extends ParseableException with Product with Serializable

    A case class representing a specific exception type BlankException used when a blank value or an error associated with a blank value is encountered during the parsing process.

    A case class representing a specific exception type BlankException used when a blank value or an error associated with a blank value is encountered during the parsing process. It extends ParseableException as its base type.

    e

    an optional Throwable cause associated with the exception. Defaults to null if not provided.

    Example:
    1. // Throwing a BlankException with a cause
      throw BlankException(new IllegalArgumentException("Blank value encountered"))
      
      // Throwing a BlankException without a cause
      throw BlankException()
  5. trait CellParser[+T] extends StringConverter[T]

    Type-class trait CellParser[T].

    Type-class trait CellParser[T]. This trait has methods to parse and to convert from String to T.

    TODO Need to define this better so that we don't have any non-implemented methods.

    T

    the (covariant) type of the resulting object.

    Annotations
    @implicitNotFound()
  6. trait CellParsers extends AnyRef

    Trait to define the various parsers for reading case classes and their parameters from table rows.

    Trait to define the various parsers for reading case classes and their parameters from table rows.

    NOTE: In each of these cellParser methods, the CellParser has a parse method which ignores the columns.

  7. case class CellValue(w: String) extends Convertible with Product with Serializable

    A concrete Convertible corresponding to a cell value.

    A concrete Convertible corresponding to a cell value.

    w

    the String contained by a cell.

  8. trait ColumnHelper[T] extends AnyRef

    Type class representing a mapping from a case class parameter to the corresponding column header.

    Type class representing a mapping from a case class parameter to the corresponding column header.

    T

    the type of the object being helped.

    Annotations
    @implicitNotFound()
  9. sealed trait Convertible extends AnyRef

    Trait Convertible.

  10. trait CopyableTableParser[Row, Input, Table] extends AnyRef

    A trait representing a parser for tables that supports configurability and row-level parsing.

    A trait representing a parser for tables that supports configurability and row-level parsing.

    The CopyableTableParser provides methods to configure the parsing behavior of tables, such as defining headers, enabling forgiving or multiline parsing modes, setting predicates for row filtering, and defining custom row parsing logic. It operates generically over three types: Row, representing a single row in the table; Input, representing raw input data for parsing rows; and Table, representing the parsed table as a whole.

    Row

    the type of a single row in the table.

    Input

    the type of the raw input data used to parse rows.

    Table

    the type of the parsed table.

  11. trait DefaultRowConfig extends RowConfig

    Default RowConfig trait.

    Default RowConfig trait.

    TODO Issue #48. Need method for default RowConfig. The problem with the current version is that, if the delimiter is changed, the string regex must change too.

  12. abstract class HeadedCSVTableParser[T] extends StringTableParser[Table[T]]

    Abstract class for parsing tables from CSV-formatted strings, where the table has a defined header.

    Abstract class for parsing tables from CSV-formatted strings, where the table has a defined header. This is the most convenient subtype of TableParser for most CSV files.

    T

    the parametric type of rows in the table.

  13. abstract class HeadedStringTableParser[X] extends StringTableParser[Table[X]] with CopyableTableParser[X, String, Table[X]]

    Abstract class to define a StringTableParser that assumes a header to be found in the input file.

    Abstract class to define a StringTableParser that assumes a header to be found in the input file. There are two subclasses: PlainTextHeadedStringTableParser and EncryptedHeadedStringTableParser This class attempts to provide as much built-in functionality as possible.

    This class assumes that the names of the columns are in the first line. This class implements builder with a HeadedTable object. This class uses StandardRowParser of its rowParser.

    NOTE that this class and HeadedCSVTableParser are extremely similar (maybe identical) CONSIDER merging with HeadedCSVTableParser

    X

    the underlying row type for which there must be evidence of a CellParser and ClassTag.

    See also

    HeadedStringTableParser#create

  14. class IndexedInputToRowsAggregator[Input, Row] extends InputAggregator[Input, Row, Try]

    The IndexedInputToRowsAggregator class provides functionality to process and aggregate input data of type Input into structured rows of type Row, with support for error handling, validation, and conditional processing.

    The IndexedInputToRowsAggregator class provides functionality to process and aggregate input data of type Input into structured rows of type Row, with support for error handling, validation, and conditional processing. It extends the abstract class InputAggregator.

    The class leverages implicit Joinable behavior for Input and works with Try to handle potential failures during the transformation of input data into rows. The flexibility is further increased with options to apply a custom predicate to filter rows, enable forgiving behavior (ignoring failures), and process multi-line inputs.

    Input

    the type of input elements to be processed.

    Row

    the type of rows transformed from the input.

  15. class IndexedInputToRowsTransformer[Input, Row] extends InputTransformer[Input, Row]

    A transformer class designed to map and process inputs to rows while handling indexed inputs.

    A transformer class designed to map and process inputs to rows while handling indexed inputs.

    This class extends InputTransformer and provides functionality to apply a transformation defined by a function f to indexed inputs ((Input, Int)), processing the resulting Try[Row] instances to either extract valid Row results or handle errors using logging.

    Input

    The type of input elements to be processed. Must have an implicit Joinable[Input] defined.

    Row

    The type of rows produced after transformation.

  16. abstract class InputAggregator[Input, Row, Wrapper[_]] extends InputPreprocessor[Input, Row]

    The InputAggregator abstract class extends the InputPreprocessor trait to provide additional higher-level processing functionality for input data.

    The InputAggregator abstract class extends the InputPreprocessor trait to provide additional higher-level processing functionality for input data. It focuses on aggregating and processing transformed rows encapsulated in Try, with support for filtering invalid or failed transformations and wrapping the successfully processed rows in a desired container type Wrapper[_].

    This class serves as an abstraction for handling the pipeline of parsing, processing, and aggregating data within a flexible and reusable structure, designed to be used in applications that involve parsing and pre-processing input data into structured forms.

    Input

    the type of input elements to be processed, such as raw data or records.

    Row

    the type of rows that result from processing the inputs, typically structured representations.

    Wrapper

    the container type used to wrap the successfully processed rows, e.g., Option, Either, or List.

  17. trait InputMapper[Input, Row] extends (Input) => Try[Row]

    A trait that defines a contract for mapping an input of type Input to a row of type Row as a computation that can either succeed or fail, represented by Try[Row].

    A trait that defines a contract for mapping an input of type Input to a row of type Row as a computation that can either succeed or fail, represented by Try[Row].

    InputMapper is designed to abstract the process of parsing or transforming an input into a structured row representation, where the input may come from any external or internal source and the row represents a meaningful structured output.

    NOTE this does not handle sequenced input. If you potentially need to handle sequenced input, use InputPreprocessor instead.

    Input

    the type of input that will be processed or parsed (e.g., raw data).

    Row

    the type of the resulting row produced by the mapping (e.g., structured data).

  18. trait InputPreprocessor[Input, Row] extends AnyRef

    A trait for preprocessing input data elements into rows, representing an early stage in data transformation pipelines.

    A trait for preprocessing input data elements into rows, representing an early stage in data transformation pipelines. The InputPreprocessor trait defines a contract for mapping input data of type Input into rows of type Row, encapsulated in Try to handle processing outcomes.

    This abstraction is intended to facilitate robust and reusable data-parsing workflows, allowing the encapsulation of individual transformations or mappings with error-handling functionality. Implementations of this trait can provide specific strategies or rules for transforming input into rows, effectively bridging raw input data and downstream processing.

    Input

    the type of input elements to be processed, e.g., raw data points or records.

    Row

    the type of rows to be produced by the mapping, e.g., structured representations of the input (such as case classes or key-value mappings).

  19. abstract class InputTransformer[Input, Row] extends InputPreprocessor[Input, Row]

    An abstract class InputTransformer that extends InputPreprocessor and defines methods for transforming input data into rows, including error handling and extracting valid data rows.

    An abstract class InputTransformer that extends InputPreprocessor and defines methods for transforming input data into rows, including error handling and extracting valid data rows.

    This class provides a scaffold for implementing data preprocessing pipelines by utilizing input-to-row transformations (mapTsToRows) and processing the results to extract valid rows while disregarding or handling errors (processTriedRows). It facilitates robust and reusable approaches in data processing workflows, making it easier to define reusable transformation logic for specific input data types and row structures.

    Input

    the type of input elements to be processed, for example, raw data records or strings.

    Row

    the type of rows to be produced after transformation, typically structured representations like case classes or tuples.

  20. case class InvalidParseException(msg: String, e: Throwable = null) extends ParseableException with Product with Serializable

    A case class representing an exception that occurs when a parsing error is encountered and the parsing operation fails to produce a valid result.

    A case class representing an exception that occurs when a parsing error is encountered and the parsing operation fails to produce a valid result.

    This exception is a specialized form of ParseableException.

    msg

    A string message providing details about the parsing error.

    e

    An optional Throwable cause for the exception (default is null).

  21. class LineParser extends JavaTokenParsers

    LineParser: class to parse lines of a CSV file.

    LineParser: class to parse lines of a CSV file. NOTE: list elements always appear as a string in the form { element0 , element1 , ... }

  22. trait MultiCellParser[T] extends CellParser[T]

    CONSIDER renaming this to something like RowParser, or RawRowParser.

    CONSIDER renaming this to something like RowParser, or RawRowParser.

    T

    the type of the result.

  23. case class MultiLineException[X](x: X) extends Exception with Product with Serializable

    The MultiLineException class is a case class that extends the Exception class.

    The MultiLineException class is a case class that extends the Exception class. This exception is designed to handle multi-line exception scenarios where custom content is provided to describe the error.

    X

    The generic type of the content that can represent the cause or context of the exception. The exception message is constructed dynamically by concatenating the string "multi-line exception: " with the provided content. Usage example:

    val exception = MultiLineException("An error occurred")
    throw exception
    x

    The content of type X that describes the exception or provides context for it.

  24. case class ParseLogicException(msg: String, e: Throwable = null) extends Exception with Product with Serializable

    Exception class representing an error encountered during parsing logic.

    Exception class representing an error encountered during parsing logic.

    This exception is used to indicate situations where parsing fails due to some issue in the business or logical rules during the process of parsing data.

    msg

    A descriptive message providing information about the error. This message is used to help diagnose the cause of the parsing failure.

    e

    The underlying cause of the exception, if any. Defaults to null if no specific cause is provided.

  25. trait Parseable[T] extends AnyRef

    Type class which describes a type which can be parsed from a String.

    Type class which describes a type which can be parsed from a String.

    T

    the resulting type.

    Annotations
    @implicitNotFound()
  26. abstract class ParseableException extends Exception

    Abstract class ParseableException is an extension of the standard Scala Exception class and provides a base structure for defining custom exceptions that can carry a parse error message and an optional cause (a Throwable).

    Abstract class ParseableException is an extension of the standard Scala Exception class and provides a base structure for defining custom exceptions that can carry a parse error message and an optional cause (a Throwable).

    This class can be used as a foundation for defining exceptions when parsing operations fail or encounter errors, allowing informative and structured error reporting.

  27. abstract class ParseableOption[T] extends Parseable[Option[T]]

    Abstract class to parse optional scala values.

    Abstract class to parse optional scala values.

    T

    the resulting type for which there must be evidence of a Parseable[T].

  28. case class ParserException(msg: String, e: Throwable = null) extends Exception with Product with Serializable

    Represents an exception that occurs during parsing operations.

    Represents an exception that occurs during parsing operations.

    msg

    the message describing the cause of the exception.

    e

    the underlying throwable that caused this exception (optional, defaults to null).

  29. case class PlainTextHeadedStringTableParser[X](maybeHeader: Option[Header] = None, forgiving: Boolean = false, headerRowsToRead: Int = 1)(implicit evidence$1: CellParser[X], evidence$2: ClassTag[X]) extends HeadedStringTableParser[X] with Product with Serializable

    Case class to define a StringTableParser that assumes a header to be found in the input file.

    Case class to define a StringTableParser that assumes a header to be found in the input file. This class attempts to provide as much built-in functionality as possible.

    This class assumes that the names of the columns are in the first line. This class implements builder with a HeadedTable object. This class uses StandardRowParser of its rowParser.

    X

    the underlying row type for which there must be evidence of a CellParser and ClassTag.

    maybeHeader

    None => requires that the data source has a header row. Some(h) => specifies that the header is to be taken from h. Defaults to None. NOTE: that the simplest is to specify the header directly from the type X.

    forgiving

    if true, exceptions when parsing individual rows will be logged then ignored. if false, any exception will terminate the parsing. Defaults to false.

    headerRowsToRead

    the number of header rows expected in the input file defaults to 1.

    See also

    HeadedStringTableParser#create

  30. abstract class RawParsers extends CellParsers

    Abstract class to define a raw parser, that's to say a Parser of Seq[String]

  31. case class RawTableParser(predicate: (Try[RawRow]) => Boolean = TableParser.includeAll, maybeHeader: Option[Header] = None, forgiving: Boolean = false, multiline: Boolean = false, headerRowsToRead: Int = 1) extends StringTableParser[RawTable] with CopyableTableParser[RawRow, String, RawTable] with Product with Serializable

    Class used to parse files as a Table of Seq[String].

    Class used to parse files as a Table of Seq[String]. That's to say, no parsing of individual (or groups of) columns.

    predicate

    a predicate which, if true, allows inclusion of the input row.

    maybeHeader

    an optional fixed header. If None, we expect to find the header defined in the first line of the file.

    forgiving

    forcing (defaults to true). If true then an individual malformed row will not prevent subsequent rows being parsed.

  32. trait RowConfig extends AnyRef

    Trait to define the configuration for parsing a row.

  33. trait RowParser[Row, Input] extends AnyRef

    Trait to describe a parser which will yield a Try[Row] from a String representing a row of a table.

    Trait to describe a parser which will yield a Try[Row] from a String representing a row of a table.

    Row

    the (parametric) Row type for which there must be evidence of a RowParser[Row, Input].

    Input

    the (parametric) Input type for which there must be evidence of a RowParser[Row, Input].

    Annotations
    @implicitNotFound()
  34. trait RowProcessor[Row] extends AnyRef

    Typeclass trait representing a row processor that defines how rows of input data can be parsed into specific types, typically useful for parsing and processing tabular data with headers.

    Typeclass trait representing a row processor that defines how rows of input data can be parsed into specific types, typically useful for parsing and processing tabular data with headers. CONSIDER finding a common super-type between this and TableParser.

    Row

    the type that each row will be processed into.

    Annotations
    @implicitNotFound()
  35. case class RowProcessorException(msg: String, e: Option[Throwable] = None) extends Exception with Product with Serializable
  36. case class RowValues(row: Row, header: Header) extends Convertible with Product with Serializable

    A concrete Convertible corresponding to a row.

    A concrete Convertible corresponding to a row.

    row

    the Row containing several values.

    header

    the Header.

  37. trait SingleCellParser[T] extends CellParser[T]

    Trait SingleCellParser, which extends CellParser[T].

    Trait SingleCellParser, which extends CellParser[T].

    T

    the type of the resulting object.

  38. case class StandardRowParser[Row](parser: LineParser)(implicit evidence$1: CellParser[Row]) extends StringParser[Row] with Product with Serializable

    StandardRowParser: a parser which extends RowParser[Row] and will yield a Try[Row] from a String representing a line of a table.

    StandardRowParser: a parser which extends RowParser[Row] and will yield a Try[Row] from a String representing a line of a table.

    Row

    the (parametric) Row type for which there must be evidence of a CellParser[Row].

    parser

    the LineParser to use

  39. case class StandardStringsParser[Row]()(implicit evidence$3: CellParser[Row]) extends StringsParser[Row] with Product with Serializable

    StandardRowParser: a parser which extends RowParser[Row] and will yield a Try[Row] from a String representing a line of a table.

    StandardRowParser: a parser which extends RowParser[Row] and will yield a Try[Row] from a String representing a line of a table.

    Row

    the (parametric) Row type for which there must be evidence of a CellParser[Row].

  40. trait StringConverter[+T] extends AnyRef
  41. type StringList = List[String]

    type alias for the results of parsing repetitions of String.

  42. trait StringParser[Row] extends RowParser[Row, String]

    A RowParser whose input type is String.

    A RowParser whose input type is String.

    Row

    the (parametric) Row type for which there must be evidence of a RowParser[Row, Input].

  43. abstract class StringRowProcessor[Row] extends AbstractRowProcessor[Row]

    Abstract class to extend AbstractTableParser but with Input = String.

    Abstract class to extend AbstractTableParser but with Input = String. This is the normal situation where a file is a sequence of Strings, each representing one line.

    Row

    the row type.

  44. abstract class StringTableParser[Table] extends AbstractTableParser[Table]

    Abstract class to extend AbstractTableParser but with Input = String.

    Abstract class to extend AbstractTableParser but with Input = String. This is the normal situation where a file is a sequence of Strings, each representing one line.

    Table

    the table type.

  45. type Strings = Seq[String]

    type alias for parsing rows which are composed of a sequence of String.

  46. trait StringsParser[Row] extends RowParser[Row, Strings]

    Trait to describe a parser which will yield a Try[Row] from a sequence of Strings representing a row of a table.

    Trait to describe a parser which will yield a Try[Row] from a sequence of Strings representing a row of a table.

    Row

    the (parametric) Row type for which there must be evidence of a CellParser[Row].

  47. abstract class StringsTableParser[Table] extends AbstractTableParser[Table]

    Abstract class to extend AbstractTableParser but with Input = Strings This is the unusual situation where a file is a sequence of a sequence of Strings, each representing one value.

    Abstract class to extend AbstractTableParser but with Input = Strings This is the unusual situation where a file is a sequence of a sequence of Strings, each representing one value.

    Table

    the table type.

  48. trait TableBuilder[Table] extends AnyRef

    Minimal trait expressing the table-building contract, independent of how the input source is read.

    Minimal trait expressing the table-building contract, independent of how the input source is read.

    TableParser extends this for string-based sources. ParquetTableParser extends this directly for Parquet sources. Future source types (JDBC ResultSet, JSON, etc.) can do the same.

    Table

    the table type to be built.

  49. trait TableParser[Table] extends TableBuilder[Table]

    Type class to parse a set of rows as a Table.

    Type class to parse a set of rows as a Table.

    Table

    the Table type.

    Annotations
    @implicitNotFound()
  50. case class TableParserException(msg: String, e: Option[Throwable] = None) extends Exception with Product with Serializable
  51. abstract class TableParserHelper[X] extends CellParsers

    TableParserHelper: abstract class to help with defining an implicit TableParser of Table[X].

    TableParserHelper: abstract class to help with defining an implicit TableParser of Table[X]. Note that this class extends CellParser[X]. It is expected that this should be sub-classed by the object which is the companion object of X. That will make it easiest for the compiler to discover the implicit value of type TableParser of Table[X]

    NOTE: this class should be used for simple cases where the the data and type X match according to one of options for sourceHasHeaderRow. More complex situations can easily be handled but not using this TableParserHelper class.

    X

    the type for which we require a TableParser[X].

Value Members

  1. def cellReader[T](implicit cellParser: CellParser[T]): CellParser[T]
  2. object AbstractTableParser

    The AbstractTableParser companion object provides utility methods for logging exceptions during the table parsing process.

    The AbstractTableParser companion object provides utility methods for logging exceptions during the table parsing process.

    This object includes methods to log exceptions, whether they are directly provided as a Throwable or wrapped inside a Try result.

  3. object AttributeSet extends CellParsers with CsvGenerators with CsvRenderers with Serializable

    The AttributeSet object provides utility methods for constructing and parsing instances of the AttributeSet class.

    The AttributeSet object provides utility methods for constructing and parsing instances of the AttributeSet class. This is primarily used for handling a column in a table that represents a set of attributes, typically formatted as a comma-separated list, and potentially enclosed in brackets or other separators.

  4. object CellParser
  5. object ColumnHelper

    Object containing utility functions for mapping and transforming column names, providing multiple default strategies for common transformations.

  6. object HeadedStringTableParser
  7. object LineParser

    Companion object for the LineParser class, responsible for constructing instances of LineParser and providing logging capabilities.

  8. object ListParser extends JavaTokenParsers

    This object is a parser of lists.

    This object is a parser of lists. A list is considered to be enclosed by {} and separated by commas.

  9. object Parseable

    The Parseable object provides a set of predefined Parseable type class instances that enable parsing of String representations into instances of various data types.

    The Parseable object provides a set of predefined Parseable type class instances that enable parsing of String representations into instances of various data types. These parsers operate based on the Parseable[T] trait, which defines a parse method that returns a Try[T].

    This framework is designed to handle common data parsing scenarios with support for additional parsing behaviors through optional modifiers.

    The parsers handle parsing errors gracefully, returning a Failure instance with an appropriate exception message when parsing fails.

  10. object ParseableOption

    The ParseableOption object provides implicit instances of ParseableOption for various types, enabling the parsing of optional Scala values.

    The ParseableOption object provides implicit instances of ParseableOption for various types, enabling the parsing of optional Scala values.

    ParseableOption works in conjunction with the abstract class of the same name, allowing strings to be parsed into optional values of specified types while handling blanks as None. This is achieved through the underlying Parseable evidence available for the corresponding type.

    The implicit objects defined here provide type-specific implementations for common data types like String, Int, Boolean, LocalDate, and more.

    These implicit objects are particularly useful in scenarios involving generic parsing where the target type is optional, and blanks should not raise errors but return None.

    Example:

    import com.phasmidsoftware.tableparser.core.parse._
    import ParseableOption._
    
    val maybeInt: Try[Option[Int]] = implicitly[Parseable[Option[Int]]].parse("42", None)
    val maybeNone: Try[Option[Int]] = implicitly[Parseable[Option[Int]]].parse("", None)

    The implicit instances provided: - ParseableOptionString: Parses optional String - ParseableOptionBoolean: Parses optional Boolean - ParseableOptionByte: Parses optional Byte - ParseableOptionShort: Parses optional Short - ParseableOptionInt: Parses optional Int - ParseableOptionFloat: Parses optional Float - ParseableOptionDouble: Parses optional Double - ParseableOptionLong: Parses optional Long - ParseableOptionBigInt: Parses optional BigInt - ParseableOptionBigDecimal: Parses optional BigDecimal - ParseableOptionLocalDate: Parses optional LocalDate - ParseableOptionURL: Parses optional java.net.URL - ParseableOptionFile: Parses optional java.io.File

  11. object RawParsers

    Object RawParsers provides utility instances for parsing raw data represented as sequences of strings.

    Object RawParsers provides utility instances for parsing raw data represented as sequences of strings. Specifically, it provides pre-configured parsers for handling different use cases.

    Example use cases include parsing data with a pre-defined header row.

  12. object RowConfig

    Companion object to RowConfig.

  13. object RowValues extends Serializable
  14. object StandardRowParser extends Serializable
  15. object StdCellParsers extends CellParsers

    TODO resolve the naming issue here.

  16. object StringConverter
  17. object TableParser

    The TableParser object provides functionality for parsing tabular data from various sources using a StringTableParser.

    The TableParser object provides functionality for parsing tabular data from various sources using a StringTableParser. It includes utilities for character-by-character parsing of sources, working with sampled data, and handling parsing results effectively. The object also provides implicit and utility functions to enhance parsing workflows.

Inherited from AnyRef

Inherited from Any

Ungrouped