com.phasmidsoftware.tableparser.core.render

Members list

Type members

Classlikes

Base class for generating CSV output for product types, such as case classes, by extending both StandardCsvGenerator and CsvProductGenerator.

Base class for generating CSV output for product types, such as case classes, by extending both StandardCsvGenerator and CsvProductGenerator.

This abstract class provides a common foundation for implementing CSV generation for specific types of products by combining the column name handling from StandardCsvGenerator with the field name extraction capabilities of CsvProductGenerator.

Type parameters

T

the type of the product for which this generator is responsible.

Value parameters

ca

an implicit parameter providing an instance of CsvAttributes, which defines the configuration for the CSV generation, such as the delimiter and quote character.

Attributes

See also

CsvAttributes for CSV configuration options.

StandardCsvGenerator for handling standard column name generation.

CsvProductGenerator for field name extraction specific to product types.

Supertypes
trait CsvGenerator[T]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait BaseCsvRenderer[-T] extends CsvRenderer[T]

Trait BaseCsvRenderer[-T] which extends CsvRenderer[T] to render, as CSV, an instance of Product (typically a case class).

Trait BaseCsvRenderer[-T] which extends CsvRenderer[T] to render, as CSV, an instance of Product (typically a case class).

Type parameters

T

the contravariant type of object to be rendered.

Attributes

Supertypes
trait CsvRenderer[T]
trait Renderer[T, String]
class Object
trait Matchable
class Any
Known subtypes
object CsvGenerator extends CsvGenerators

Companion object for the CsvGenerator type class providing implicit instances for various types.

Companion object for the CsvGenerator type class providing implicit instances for various types.

The implicit generators defined here are standard implementations used to generate CSV headers for specific data types. These generators are derived from predefined instances in the CsvGenerators object.

Implicit instances:

  • Integer values (Int), using CsvGenerators.CsvGeneratorInt
  • String values (String), using CsvGenerators.CsvGeneratorString
  • Boolean values (Boolean), using CsvGenerators.CsvGeneratorBoolean
  • Double-precision floating-point numbers (Double), using CsvGenerators.CsvGeneratorDouble
  • Arbitrarily large integers (BigInt), using CsvGenerators.CsvGeneratorBigInt
  • Long integer values (Long), using CsvGenerators.CsvGeneratorLong
  • URL values from the java.net package (java.net.URL), using CsvGenerators.CsvGeneratorURL

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait CsvGenerator[-T]

Trait (typeclass) for generating headers for CSV output.

Trait (typeclass) for generating headers for CSV output.

CONSIDER why do we need this? It takes a lot of effort to set up, which is essentially the same as for CsvRenderer[T].

NOTE: this is an unusual type class in that none of its methods reference type T.

Type parameters

T

the contravariant type of the objects to be rendered by CSV.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

The CsvGenerators class provides factory methods for creating CsvGenerator instances for different types of data structures. These generators can be used to serialize data into CSV (Comma-Separated Values) format.

The CsvGenerators class provides factory methods for creating CsvGenerator instances for different types of data structures. These generators can be used to serialize data into CSV (Comma-Separated Values) format.

The class includes methods to handle sequences, options, individual types, and products (case classes with varying numbers of fields). It supports up to 6-ary product types, allowing for type inference and customization of CSV behavior.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AttributeSet
object CsvGenerator
object CsvGenerators

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait CsvProduct[-T] extends CsvRenderer[T], CsvGenerator[T]

Type class which combines CsvRenderer and CsvGenerator

Type class which combines CsvRenderer and CsvGenerator

Type parameters

T

the contravariant type of object to be rendered.

Attributes

Companion
object
Supertypes
trait CsvGenerator[T]
trait CsvRenderer[T]
trait Renderer[T, String]
class Object
trait Matchable
class Any
Show all
Known subtypes
object CsvProduct

Companion object for CsvProduct, which renders a case class and generates its column names.

Companion object for CsvProduct, which renders a case class and generates its column names.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
CsvProduct.type
trait CsvProductGenerator[T] extends CsvGenerator[T]

Trait (typeclass) for generating headers for CSV output.

Trait (typeclass) for generating headers for CSV output.

NOTE: this is an unusual type class in that none of its methods reference type T.

Type parameters

T

the type of the objects to be rendered by CSV.

Attributes

Supertypes
trait CsvGenerator[T]
class Object
trait Matchable
class Any
Known subtypes
trait CsvRenderer[-T] extends Renderer[T, String]

Type class for rendering instances to CSV.

Type class for rendering instances to CSV.

Type parameters

T

the contravariant type of object to be rendered.

Attributes

Companion
object
Supertypes
trait Renderer[T, String]
class Object
trait Matchable
class Any
Known subtypes
object CsvRenderer extends CsvRenderers

An object that provides type class support for rendering data as CSV (Comma-Separated Values).

An object that provides type class support for rendering data as CSV (Comma-Separated Values).

The CsvRenderer object is designed to define implicit instances of CsvRenderer for specific types, allowing those types to be rendered to a CSV format string. It relies on the Renderer type class, which generalizes rendering objects of type T into objects of type O (in this case, strings).

This object can include predefined implicit renderers (e.g., Row renderer) that leverage attributes (Map[String, String]) to modify the output or handle special behaviors for CSV attributes.

Attributes

Companion
trait
Supertypes
trait CsvRenderers
class Object
trait Matchable
class Any
Self type
object CsvRenderers

The CsvRenderers object provides a collection of implicit StandardCsvRenderer implementations for common data types. These renderers are used to convert data of specific types into CSV (Comma-Separated Values) format according to the defined rendering logic.

The CsvRenderers object provides a collection of implicit StandardCsvRenderer implementations for common data types. These renderers are used to convert data of specific types into CSV (Comma-Separated Values) format according to the defined rendering logic.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait CsvRenderers

Trait to define various renderers for rendering instance of case classes (with their various parameters), containers (Seq and Option), etc. to CSV output.

Trait to define various renderers for rendering instance of case classes (with their various parameters), containers (Seq and Option), etc. to CSV output.

CONSIDER a mechanism to ensure that objects involving case classes are presented in the same order as specified by the header.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AttributeSet
object CsvRenderer

Singleton companion object providing a factory method to create instances of CsvTableFileRenderer.

Singleton companion object providing a factory method to create instances of CsvTableFileRenderer.

This object simplifies the instantiation of CsvTableFileRenderer, allowing the user to provide a File directly, which is internally converted to a Path. Implicit instances of CsvRenderer, CsvGenerator, and CsvAttributes are required to define CSV rendering logic, header generation, and formatting options.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class CsvTableFileRenderer[T](path: Path)(using z1: CsvRenderer[T], z2: CsvGenerator[T], csvAttributes: CsvAttributes) extends CsvTableRenderer[T, FileWriter]

Case class to help render a Table to a File in CSV format.

Case class to help render a Table to a File in CSV format.

TODO merge this with CsvTableEncryptedFileRenderer to avoid duplicate code.

Type parameters

T

the type of object to be rendered, must provide evidence of CsvRenderer[T] amd CsvGenerator[T].

Value parameters

csvAttributes

implicit instance of CsvAttributes.

path

the path to which the table will be written.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class CsvTableRenderer[T, FileWriter]
trait Renderer[Table[T], Try[FileWriter]]
class Object
trait Matchable
class Any
Show all
abstract class CsvTableRenderer[T, O]()(using z1: CsvRenderer[T], z2: CsvGenerator[T], z3: Writable[O], ca: CsvAttributes) extends Renderer[Table[T], Try[O]]

Abstract class for rendering a tabular representation of type Table[T] to a sequentially writable format O, such as CSV, while utilizing implicit type classes for rendering cells and generating column names.

Abstract class for rendering a tabular representation of type Table[T] to a sequentially writable format O, such as CSV, while utilizing implicit type classes for rendering cells and generating column names.

This class simplifies the conversion of tabular data (Table[T]) into a structured format (O) with support for customization through attributes and allows seamless integration with CSV-specific typeclasses.

Type parameters

O

the type of the writable output; must have implicit evidence for Writable.

T

the type of elements contained within the table; must have implicit evidence for CsvRenderer and CsvGenerator.

Attributes

Supertypes
trait Renderer[Table[T], Try[O]]
class Object
trait Matchable
class Any
Known subtypes
case class CsvTableStringRenderer[T]()(using z1: CsvRenderer[T], z2: CsvGenerator[T], csvAttributes: CsvAttributes) extends CsvTableRenderer[T, StringBuilder]

Case class to help render a Table to a StringBuilder in CSV format.

Case class to help render a Table to a StringBuilder in CSV format.

Type parameters

T

the type of object to be rendered; must provide evidence of CsvRenderer[T] amd CsvGenerator[T].

Value parameters

csvAttributes

implicit instance of CsvAttributes.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class CsvTableRenderer[T, StringBuilder]
trait Renderer[Table[T], Try[StringBuilder]]
class Object
trait Matchable
class Any
Show all
trait HierarchicalRenderer[T] extends Renderer[T, Node]

Definition of type class HierarchicalRenderer for the purpose of serializing objects of type T. Since, in general, T will be a case class which may include parameters which are case classes, we render to a hierarchical type: Node.

Definition of type class HierarchicalRenderer for the purpose of serializing objects of type T. Since, in general, T will be a case class which may include parameters which are case classes, we render to a hierarchical type: Node.

Type parameters

T

the type of object to be rendered.

Attributes

Companion
object
Supertypes
trait Renderer[T, Node]
class Object
trait Matchable
class Any
Known subtypes

Object HierarchicalRenderer provides a collection of implicit instances and type definitions for the UntaggedHierarchicalRenderer trait, allowing for hierarchical serialization of various primitive and common types such as String, Boolean, Int, Long, BigInt, Double, and LocalDate.

Object HierarchicalRenderer provides a collection of implicit instances and type definitions for the UntaggedHierarchicalRenderer trait, allowing for hierarchical serialization of various primitive and common types such as String, Boolean, Int, Long, BigInt, Double, and LocalDate.

These implicit objects define how to render instances of their respective types into a hierarchical structure (Node) by extending the generic UntaggedHierarchicalRenderer which implements the HierarchicalRenderer interface.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Trait to define various renderers for rendering instance of case classes (with their various parameters), containers (Seq and Option), etc. to hierarchical output elements such as XML or HTML.

Trait to define various renderers for rendering instance of case classes (with their various parameters), containers (Seq and Option), etc. to hierarchical output elements such as XML or HTML.

Attributes

Supertypes
class Object
trait Matchable
class Any
class ProductCsvGenerator[T](fieldNames: List[String], fieldGenerators: List[CsvGenerator[_]])(using ca: CsvAttributes, helper: ColumnHelper[T]) extends BaseCsvProductGenerator[T]

The CsvGenerator of a case class T, as derived by CsvGenerator.derived.

The CsvGenerator of a case class T, as derived by CsvGenerator.derived.

Type parameters

T

the type of the case class.

Value parameters

ca

the CsvAttributes.

fieldGenerators

the CsvGenerators of the fields of T, in the same order.

fieldNames

the names of the fields of T, in declaration order.

helper

the ColumnHelper[T], which gives the column name of each field.

Attributes

Supertypes
trait CsvGenerator[T]
class Object
trait Matchable
class Any
Show all
Known subtypes
class ProductCsvProduct[T](fieldNames: List[String], fieldRenderers: List[CsvRenderer[_]], fieldGenerators: List[CsvGenerator[_]])(using ca: CsvAttributes, helper: ColumnHelper[T]) extends ProductCsvGenerator[T], BaseCsvRenderer[T], CsvProduct[T]

The CsvProduct of a case class T, as derived by CsvProduct.derived: a ProductCsvGenerator which is also a CsvRenderer.

The CsvProduct of a case class T, as derived by CsvProduct.derived: a ProductCsvGenerator which is also a CsvRenderer.

Type parameters

T

the type of the case class.

Value parameters

ca

the CsvAttributes.

fieldGenerators

the CsvGenerators of the fields of T, in the same order.

fieldNames

the names of the fields of T, in declaration order.

fieldRenderers

the CsvRenderers of the fields of T, in the same order.

helper

the ColumnHelper[T].

Attributes

Supertypes
trait CsvProduct[T]
trait BaseCsvRenderer[T]
trait CsvRenderer[T]
trait Renderer[T, String]
trait CsvGenerator[T]
class Object
trait Matchable
class Any
Show all
class ProductCsvRenderer[T](fieldRenderers: List[CsvRenderer[_]])(using ca: CsvAttributes) extends BaseCsvRenderer[T]

The CsvRenderer of a case class T, as derived by CsvRenderer.derived. Each field is rendered by its own CsvRenderer, and the results are separated by the delimiter.

The CsvRenderer of a case class T, as derived by CsvRenderer.derived. Each field is rendered by its own CsvRenderer, and the results are separated by the delimiter.

Type parameters

T

the type of the case class.

Value parameters

ca

the CsvAttributes.

fieldRenderers

the CsvRenderers of the fields of T, in declaration order.

Attributes

Companion
object
Supertypes
trait BaseCsvRenderer[T]
trait CsvRenderer[T]
trait Renderer[T, String]
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class ProductFieldsHierarchicalRenderer[T](style: String, attrs: Map[String, String], fieldNames: List[String], fieldRenderers: List[HierarchicalRenderer[_]]) extends ProductHierarchicalRenderer[T]

The HierarchicalRenderer of a case class T, as derived by HierarchicalRenderer.derived.

The HierarchicalRenderer of a case class T, as derived by HierarchicalRenderer.derived.

Type parameters

T

the type of the case class.

Value parameters

attrs

the base attributes of the node for a T.

fieldNames

the names of the fields of T, in declaration order.

fieldRenderers

the HierarchicalRenderers of the fields of T, in the same order.

style

the style of the node for a T.

Attributes

Supertypes
trait Renderer[T, Node]
class Object
trait Matchable
class Any
Show all
abstract class ProductHierarchicalRenderer[T](val style: String, val baseAttrs: Map[String, String] = ...) extends HierarchicalRenderer[T]

Abstract class ProductHierarchicalRenderer

Abstract class ProductHierarchicalRenderer

Type parameters

T

the type of object to be rendered.

Value parameters

baseAttrs

baseAttrs (a Map[String, String]

style

the style (a String)

Attributes

Supertypes
trait Renderer[T, Node]
class Object
trait Matchable
class Any
Known subtypes
trait Renderer[-T, O]

Definition of trait Renderer for the purpose of serializing objects of type T as an object of type O. This trait may be used as a type class for either T or O (or both).

Definition of trait Renderer for the purpose of serializing objects of type T as an object of type O. This trait may be used as a type class for either T or O (or both).

NOTE: this trait has no direct relationship with TableRenderable.

Type parameters

O

the type of the serialization result.

T

the (contravariant) type of object to be rendered.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class StandardCsvGenerator[T](using ca: CsvAttributes) extends CsvGenerator[T]

The StandardCsvGenerator class extends the CsvGenerator trait to provide functionality for generating standardized CSV output. It utilizes implicit CsvAttributes for configuring the delimiter and quote character used in the CSV representation.

The StandardCsvGenerator class extends the CsvGenerator trait to provide functionality for generating standardized CSV output. It utilizes implicit CsvAttributes for configuring the delimiter and quote character used in the CSV representation.

Type parameters

T

the type of the objects for which this generator creates column names.

Value parameters

ca

an implicit instance of CsvAttributes which defines the delimiter and quote character.

Attributes

Constructor

Creates a new StandardCsvGenerator instance with implicit CsvAttributes providing the configuration for CSV generation.

Supertypes
trait CsvGenerator[T]
class Object
trait Matchable
class Any
Known subtypes
trait TableRenderable[X]

Polymorphic trait which defines the behavior of some sort of collection with an underlying type X and which can be rendered.

Polymorphic trait which defines the behavior of some sort of collection with an underlying type X and which can be rendered.

CONSIDER: do we really need this trait? This trait is not, strictly speaking, a typeclass because X does not appear as a parameter or result of any of the methods. However, it cannot be sealed which implies that it is used as a typeclass.

NOTE: this trait has no direct relationship with Renderer. CONSIDER a refactoring of the whole set of traits.

Type parameters

X

the underlying type of this TableRenderable.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class RenderableTable[Row]
class HeadedTable[Row]
class UnheadedTable[Row]
abstract class TaggedHierarchicalRenderer[T](val style: String, val baseAttrs: Map[String, String] = ...) extends HierarchicalRenderer[T]

Abstract class TaggedHierarchicalRenderer.

Abstract class TaggedHierarchicalRenderer.

Type parameters

T

the type of object to be rendered.

Value parameters

baseAttrs

baseAttrs (a Map[String, String]

style

the style (a String)

Attributes

Supertypes
trait Renderer[T, Node]
class Object
trait Matchable
class Any

CONSIDER having style defined as an Option[String]

CONSIDER having style defined as an Option[String]

Type parameters

T

the type of object to be rendered.

Attributes

Supertypes
trait Renderer[T, Node]
class Object
trait Matchable
class Any
Known subtypes