AttributeSet

com.phasmidsoftware.tableparser.core.parse.AttributeSet
See theAttributeSet companion 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.

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
trait CsvRenderers
trait CellParsers
class Object
trait Matchable
class Any
Show all
Self type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply(w: String): AttributeSet

This method is required to be a String=>AttributeSet and is only invoked inside Try. It invokes parse to get its result.

This method is required to be a String=>AttributeSet and is only invoked inside Try. It invokes parse to get its result.

NOTE: essentially, we are doing a get, and trying to make it explicit so that Codacy doesn't get upset ;)

Value parameters

w

the String to be converted to an AttributeSet.

Attributes

Returns

an AttributeSet.

def parse(w: String): Try[AttributeSet]

Method to parse a String as an AttributeSet.

Method to parse a String as an AttributeSet.

Value parameters

w

the String to be parsed as an AttributeSet.

Attributes

Returns

a Try[AttributeSet]

Inherited methods

def cellParser[P : CellParser, T](construct: P => T): CellParser[T]

Method to return a CellParser[T] based on a function to convert a P into a T

Method to return a CellParser[T] based on a function to convert a P into a T

Type parameters

P

the type of the intermediate type.

T

the underlying type of the result.

Value parameters

construct

a function P => T.

Attributes

Returns

a SingleCellParser which converts a String into the intermediate type P and thence into a T

Inherited from:
CellParsers
inline def cellParser2Conditional[K, P, T](construct: (K, P) => T, parsers: Map[K, CellParser[P]])(using kp: CellParser[K], m: ProductOf[T], helper: ColumnHelper[T]): CellParser[T]

Method to return a CellParser[T] where T is a 2-ary Product and which is based on a function to convert a (K,P) into a T. This method differs from cellParser2 in that the parser of P (a CellParser[P]) is not found implicitly, but rather is looked up dynamically depending on the value of the first parameter (of type K).

Method to return a CellParser[T] where T is a 2-ary Product and which is based on a function to convert a (K,P) into a T. This method differs from cellParser2 in that the parser of P (a CellParser[P]) is not found implicitly, but rather is looked up dynamically depending on the value of the first parameter (of type K).

Type parameters

K

the type of the conditional lookup key, which is also the type of the first field of T. Typically, this will be a String, but it could also be an Int or something more exotic.

P

the type of the second field of the Product type T.

T

the underlying type of the result, a case class with two fields.

Value parameters

construct

a function (K,P) => T, usually the apply method of a case class.

helper

the ColumnHelper[T].

m

the Mirror of T, from which the field names come.

parsers

a Map[K, CellParser[P]] which determines which particular parser of P will be used. The key value looked up is the value of the first (K) field.

Attributes

Returns

a MultiCellParser which converts Strings from a Row into the field types K and P and thence into a T.

Inherited from:
CellParsers
def cellParserOption[P : CellParser]: CellParser[Option[P]]

Method to return a CellParser[Option[P]].

Method to return a CellParser[Option[P]].

This class is used for optional types which are non-scalar, i.e., there are no implicitly defined parsers for the Option[P].

Type parameters

P

the underlying type of the result

Attributes

Returns

a SingleCellParser[Option[P]]

Inherited from:
CellParsers
def cellParserRepetition[P : CellParser](start: Int = ...): CellParser[Seq[P]]

Method to return a CellParser[Seq[P]] from a potentially unlimited set of P objects. The counting of the elements starts at start (defaults to 1).

Method to return a CellParser[Seq[P]] from a potentially unlimited set of P objects. The counting of the elements starts at start (defaults to 1).

Type parameters

P

the underlying type of the result

Attributes

Returns

a MultiCellParser[Seq[P]

Inherited from:
CellParsers
def cellParserSeq[P : CellParser]: CellParser[Seq[P]]

Method to return a CellParser[Seq[P]. This is used only by unit tests. CONSIDER eliminating this; only used in unit tests

Method to return a CellParser[Seq[P]. This is used only by unit tests. CONSIDER eliminating this; only used in unit tests

Type parameters

P

the underlying type of the result

Attributes

Returns

a MultiCellParser[Seq[P]

Inherited from:
CellParsers
def columnHelper[T](aliases: (String, String)*): ColumnHelper[T]

Method to yield a ColumnHelper[T] based on some number of explicit aliases,

Method to yield a ColumnHelper[T] based on some number of explicit aliases,

Type parameters

T

the underlying type of the resulting ColumnHelper

Value parameters

aliases

a variable number of explicit aliases to translate specific case class parameter names into their column name equivalents.

Attributes

Returns

a new instance of ColumnHelper[T]

Inherited from:
CellParsers
def columnHelper[T](columnNameMapper: String => String, maybePrefix: Option[String], aliases: (String, String)*): ColumnHelper[T]

Method to yield a ColumnHelper[T] based on a column name mapper, an optional prefix, and some number of explicit aliases,

Method to yield a ColumnHelper[T] based on a column name mapper, an optional prefix, and some number of explicit aliases,

Type parameters

T

the underlying type of the resulting ColumnHelper

Value parameters

aliases

a variable number of explicit aliases to translate specific case class parameter names into their column name equivalents.

columnNameMapper

a mapper of String=>String which will translate case class parameter names into column names.

maybePrefix

an optional prefix for the column name.

Attributes

Returns

a new instance of ColumnHelper[T]

Inherited from:
CellParsers
def columnHelper[T](columnNameMapper: String => String, aliases: (String, String)*): ColumnHelper[T]

Method to yield a ColumnHelper[T] based on a column name mapper, and some number of explicit aliases,

Method to yield a ColumnHelper[T] based on a column name mapper, and some number of explicit aliases,

Type parameters

T

the underlying type of the resulting ColumnHelper

Value parameters

aliases

a variable number of explicit aliases to translate specific case class parameter names into their column name equivalents.

columnNameMapper

a mapper of String=>String which will translate case class parameter names into column names.

Attributes

Returns

a new instance of ColumnHelper[T]

Inherited from:
CellParsers
def columnHelper[T](maybePrefix: Option[String], aliases: (String, String)*): ColumnHelper[T]

Method to yield a ColumnHelper[T] based on an optional prefix, and some number of explicit aliases,

Method to yield a ColumnHelper[T] based on an optional prefix, and some number of explicit aliases,

Type parameters

T

the underlying type of the resulting ColumnHelper

Value parameters

aliases

a variable number of explicit aliases to translate specific case class parameter names into their column name equivalents.

maybePrefix

an optional prefix for the column name.

Attributes

Returns

a new instance of ColumnHelper[T]

Inherited from:
CellParsers
def optionGenerator[T](using ca: CsvAttributes): CsvGenerator[Option[T]]

Method to return a CsvGenerator[ Option[T] ].

Method to return a CsvGenerator[ Option[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Attributes

Returns

a CsvGenerator[ Option[T] ].

Inherited from:
CsvGenerators
def optionProductGenerator[T](using g: CsvGenerator[T]): CsvGenerator[Option[T]]

Method to return a CsvGenerator[Option[T]] whose columns are those of T. Use this for an optional field whose type has several columns (e.g. a case class), together with CsvRenderers.optionProductRenderer. (optionGenerator gives an Option just one column.)

Method to return a CsvGenerator[Option[T]] whose columns are those of T. Use this for an optional field whose type has several columns (e.g. a case class), together with CsvRenderers.optionProductRenderer. (optionGenerator gives an Option just one column.)

Type parameters

T

the underlying type.

Value parameters

g

the CsvGenerator[T].

Attributes

Returns

a CsvGenerator[Option[T]].

Inherited from:
CsvGenerators
def optionProductRenderer[T](using r: CsvRenderer[T], g: CsvGenerator[T], ca: CsvAttributes): CsvRenderer[Option[T]]

Method to return a CsvRenderer[Option[T]] for a T which has several columns (e.g. a case class). None is rendered as the right number of empty cells, so that the columns which follow stay aligned. Use this together with CsvGenerators.optionProductGenerator. (optionRenderer renders None as just one cell.)

Method to return a CsvRenderer[Option[T]] for a T which has several columns (e.g. a case class). None is rendered as the right number of empty cells, so that the columns which follow stay aligned. Use this together with CsvGenerators.optionProductGenerator. (optionRenderer renders None as just one cell.)

Type parameters

T

the underlying type.

Value parameters

ca

the CsvAttributes.

g

the CsvGenerator[T], which determines how many columns a T has.

r

the CsvRenderer[T].

Attributes

Returns

a CsvRenderer[Option[T]].

Inherited from:
CsvRenderers
def optionRenderer[T](defaultString: String = ...)(using evidence$1: CsvRenderer[T], ca: CsvAttributes): CsvRenderer[Option[T]]

Method to return a CsvRenderer[ Option[T] ].

Method to return a CsvRenderer[ Option[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Value parameters

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[ Option[T] ].

Inherited from:
CsvRenderers

Method to return a CellParser[RawRow] from a Row.

Method to return a CellParser[RawRow] from a Row.

Attributes

Returns

a CellParser[RawRow]

Inherited from:
CellParsers

Method to return a CsvRenderer[RawRow].

Method to return a CsvRenderer[RawRow].

Value parameters

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[RawRow].

Inherited from:
CsvRenderers
def sequenceGenerator[T](using ca: CsvAttributes): CsvGenerator[Seq[T]]

Method to return a CsvGenerator[ Seq[T] ].

Method to return a CsvGenerator[ Seq[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Attributes

Returns

a CsvGenerator[ Seq[T] ]

Inherited from:
CsvGenerators
def sequenceRenderer[T](using evidence$1: CsvRenderer[T], ca: CsvAttributes): CsvRenderer[Seq[T]]

Method to return a CsvRenderer[ Seq[T] ].

Method to return a CsvRenderer[ Seq[T] ].

Type parameters

T

the underlying type of the first parameter of the input to the render method.

Value parameters

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[ Seq[T] ]

Inherited from:
CsvRenderers
def skipGenerator[T](using ca: CsvAttributes): CsvGenerator[T]

Method to return a CsvGenerator[T] which does not output a column header for at all.

Method to return a CsvGenerator[T] which does not output a column header for at all.

Type parameters

T

the type of the column objects.

Attributes

Returns

a CsvGenerator[T].

Inherited from:
CsvGenerators
def skipRenderer[T](alignment: Int = ...)(using ca: CsvAttributes): CsvRenderer[T]

Method to return a CsvRenderer[T] which does not output a T at all, only a number of delimiters according to the value of alignment.

Method to return a CsvRenderer[T] which does not output a T at all, only a number of delimiters according to the value of alignment.

Type parameters

T

the type of the parameter to the render method.

Value parameters

alignment

(defaults to 1): one more than the number of delimiters to output. If you are skipping a Product (such as a case class instance), then you should carefully count up how many (nested) elements to skip. So, for example, if you are skipping a Product with three members, you would set alignment = 3, even though you only want to output 2 delimiters.

ca

the (implicit) CsvAttributes.

Attributes

Returns

a CsvRenderer[T].

Inherited from:
CsvRenderers

Concrete fields

Inherited fields

lazy val cellParserOptionNonEmptyString: CellParser[Option[String]]

Method to return a CellParser[Option[String].

Method to return a CellParser[Option[String].

TODO: why do we need this in addition to cellParserOption?

CONSIDER: using BlankException as above...

Attributes

Returns

a SingleCellParser[Option[String]

Inherited from:
CellParsers

Givens

Inherited givens

given optionBigIntGenerator: CsvGenerator[Option[BigInt]]

Attributes

Inherited from:
CsvGenerators
given optionBooleanGenerator: CsvGenerator[Option[Boolean]]

Attributes

Inherited from:
CsvGenerators
given optionByteGenerator: CsvGenerator[Option[Byte]]

Attributes

Inherited from:
CsvGenerators
given optionDoubleGenerator: CsvGenerator[Option[Double]]

Attributes

Inherited from:
CsvGenerators
given optionFloatGenerator: CsvGenerator[Option[Float]]

Attributes

Inherited from:
CsvGenerators
given optionInstantGenerator: CsvGenerator[Option[Instant]]

Attributes

Inherited from:
CsvGenerators
given optionIntGenerator: CsvGenerator[Option[Int]]

Attributes

Inherited from:
CsvGenerators
given optionLocalDateGenerator: CsvGenerator[Option[LocalDate]]

Attributes

Inherited from:
CsvGenerators
given optionLongGenerator: CsvGenerator[Option[Long]]

Attributes

Inherited from:
CsvGenerators
given optionShortGenerator: CsvGenerator[Option[Short]]

Attributes

Inherited from:
CsvGenerators
given optionStringGenerator: CsvGenerator[Option[String]]

Attributes

Inherited from:
CsvGenerators