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.
- Alphabetic
- By Inheritance
- CsvRenderers
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract class StandardCsvRenderer[T] extends CsvRenderer[T]
The
StandardCsvRendereris an abstract class that provides a base implementation of theCsvRenderertrait for rendering objects of typeTinto CSV (Comma-Separated Values) format.The
StandardCsvRendereris an abstract class that provides a base implementation of theCsvRenderertrait for rendering objects of typeTinto CSV (Comma-Separated Values) format.This class is typically extended to create concrete renderers for specific types. By default, it implements the
rendermethod to simply convert the input object to its string representation, but this behavior may be overridden in subclasses to implement more specific serialization logic.- T
The type of object to be rendered into CSV format.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def quoteIfNecessary(w: String)(implicit ca: CsvAttributes): String
Method to quote a String as a CSV field (as in RFC 4180), if it has to be quoted to be read back as it is: that is, if it contains the delimiter, the quote character or a line break, or if it starts or ends with whitespace.
Method to quote a String as a CSV field (as in RFC 4180), if it has to be quoted to be read back as it is: that is, if it contains the delimiter, the quote character or a line break, or if it starts or ends with whitespace. Any quote characters inside it are doubled.
- w
the String.
- ca
the CsvAttributes (for the delimiter and the quote character).
- returns
the String, quoted if necessary.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- implicit object CsvRendererBoolean extends StandardCsvRenderer[Boolean]
An implicit object for rendering
Booleanvalues into CSV (Comma-Separated Values) format.An implicit object for rendering
Booleanvalues into CSV (Comma-Separated Values) format.CsvRendererBooleanextends theStandardCsvRendererabstraction, which provides a base implementation for converting objects into their CSV string representation.This implicit object handles the rendering of
Booleanvalues by converting them to their string representation, typically as"true"or"false".Usage: The
CsvRendererBooleancan be implicitly used wherever aStandardCsvRenderer[Boolean]is required, enabling seamless conversion ofBooleanvalues to CSV-compatible strings.Example:
// Assuming an implicit `CsvAttributes` in scope val renderer = implicitly[StandardCsvRenderer[Boolean]] val csvValue = renderer.render(true, Map.empty) println(csvValue) // Output: "true"
- implicit object CsvRendererByte extends StandardCsvRenderer[Byte]
An implicit implementation of the
StandardCsvRendererfor theBytetype.An implicit implementation of the
StandardCsvRendererfor theBytetype.The
CsvRendererByteobject provides functionality to renderBytevalues into CSV format by extending theStandardCsvRendererabstract class. This implementation defines the specific rendering behavior for convertingBytetype data into its CSV-compatible string representation. - implicit object CsvRendererDouble extends StandardCsvRenderer[Double]
CsvRendererDoubleis an implicit object that provides a mechanism to render instances of typeDoubleinto a CSV (Comma-Separated Values) format.CsvRendererDoubleis an implicit object that provides a mechanism to render instances of typeDoubleinto a CSV (Comma-Separated Values) format. It extends theStandardCsvRendererabstract class, inheriting its generic rendering capabilities, and specializes the functionality forDoublevalues.This implicit object allows seamless and type-safe rendering of
Doubles into strings formatted for CSV output by leveraging Scala's implicit resolution mechanism.Example usage:
import CsvRenderers._ val value: Double = 123.456 val renderedValue: String = CsvRendererDouble.render(value) println(renderedValue) // Output: "123.456"
The
CsvRendererDoublerelies on the default implementation ofrenderin theStandardCsvRendererclass, where theDoubleis converted to its string representation. Custom attributes influencing the rendering may be passed via a map, though they are unused in the default implementation.- See also
com.phasmidsoftware.tableparser.core.render.StandardCsvRenderer
- implicit object CsvRendererFloat extends StandardCsvRenderer[Float]
Implicit object that provides a CSV renderer for
Floatvalues by extending theStandardCsvRendererabstract class with type parameterFloat.Implicit object that provides a CSV renderer for
Floatvalues by extending theStandardCsvRendererabstract class with type parameterFloat.This renderer converts
Floatvalues into their CSV string representation, utilizing the default behavior from theStandardCsvRendererclass unless overridden. The implicit nature of this object allows it to be automatically used wherever aStandardCsvRendererforFloatis required.This renderer adheres to the base
CsvRenderertrait interface, enabling consistent rendering ofFloatvalues in CSV-related operations. - implicit object CsvRendererInstant extends CsvRenderer[Instant]
- implicit object CsvRendererInt extends StandardCsvRenderer[Int]
Implicit object
CsvRendererIntprovides a concrete implementation of theStandardCsvRendererclass for renderingIntvalues into CSV (Comma-Separated Values) format.Implicit object
CsvRendererIntprovides a concrete implementation of theStandardCsvRendererclass for renderingIntvalues into CSV (Comma-Separated Values) format.This object allows the rendering of integer values into their string representation for use in CSV output while adhering to the conventions defined in the
StandardCsvRendererabstraction.Being defined as implicit, it can be automatically utilized in any context where a
StandardCsvRenderer[Int]is required, enabling seamless integration into systems that rely on type class-based serialization for CSV export. - implicit object CsvRendererLong extends StandardCsvRenderer[Long]
Implicit object
CsvRendererLongprovides aStandardCsvRendererimplementation specifically for theLongtype.Implicit object
CsvRendererLongprovides aStandardCsvRendererimplementation specifically for theLongtype.This renderer is used to convert
Longvalues into their CSV (Comma-Separated Values) string representation. It extends theStandardCsvRendererabstract class, which defines a default rendering mechanism by converting the input object to itsStringrepresentation.As an implicit object,
CsvRendererLongcan be automatically applied wherever aStandardCsvRenderer[Long]is required in the context of CSV rendering operations, such as serializing data of typeLonginto CSV format.Example usage:
implicit val csvAttributes: CsvAttributes = CsvAttributes() // Example of CSV configuration val longValue: Long = 123456789L val csvString: String = CsvRendererLong.render(longValue, Map.empty) // "123456789"
Note: Additional attributes passed in the
Mapparameter to therendermethod are supported but not utilized in this implementation. - implicit object CsvRendererShort extends StandardCsvRenderer[Short]
Implicit object providing a CSV renderer for the
Shorttype.Implicit object providing a CSV renderer for the
Shorttype.This object extends the
StandardCsvRendererclass, implementing the base functionality to renderShortvalues into their string representation in CSV format. It can be used implicitly wherever aCsvRenderer[Short]is required.It adheres to the default behavior of
StandardCsvRenderer, which converts the given value to its string representation without applying additional attributes or custom processing. - implicit object CsvRendererString extends StandardCsvRenderer[String]
- implicit object CsvRendererURL extends StandardCsvRenderer[URL]
Provides an implicit instance of
StandardCsvRendererfor the typejava.net.URL.Provides an implicit instance of
StandardCsvRendererfor the typejava.net.URL.This object is used to render
URLinstances into their CSV (Comma-Separated Values) string representation. It extends theStandardCsvRendererclass, leveraging its default implementation for converting objects into a string format. Specifically, forURLinstances, thetoStringmethod of the URL is used as the rendered string by default, unless overridden.The renderer is intended for scenarios where
URLobjects need to be serialized or exported in CSV format, commonly for data processing or storage purposes.Example usage:
val url: URL = new URL("https://example.com") val renderedCsv: String = implicitly[StandardCsvRenderer[URL]].render(url, Map()) // renderedCsv would contain "https://example.com"
This implicit object allows seamless usage of
URLtype rendering in contexts whereStandardCsvRendereris required, such as within collections or for pipeline-based CSV serialization.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)