ParseableOption

com.phasmidsoftware.tableparser.core.parse.ParseableOption
See theParseableOption companion class

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]] = summon[Parseable[Option[Int]]].parse("42", None)
val maybeNone: Try[Option[Int]] = summon[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

Attributes

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

Members list

Type members

Classlikes

object ParseableOptionBigDecimal extends ParseableOption[BigDecimal]

Attributes

Supertypes
class ParseableOption[BigDecimal]
trait Parseable[Option[BigDecimal]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionBigInt extends ParseableOption[BigInt]

Attributes

Supertypes
class ParseableOption[BigInt]
trait Parseable[Option[BigInt]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionBoolean extends ParseableOption[Boolean]

Attributes

Supertypes
class ParseableOption[Boolean]
trait Parseable[Option[Boolean]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionByte extends ParseableOption[Byte]

Attributes

Supertypes
class ParseableOption[Byte]
trait Parseable[Option[Byte]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionDouble extends ParseableOption[Double]

Attributes

Supertypes
class ParseableOption[Double]
trait Parseable[Option[Double]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionFile extends ParseableOption[File]

Attributes

Supertypes
class ParseableOption[File]
trait Parseable[Option[File]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionFloat extends ParseableOption[Float]

Attributes

Supertypes
class ParseableOption[Float]
trait Parseable[Option[Float]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionInt extends ParseableOption[Int]

Attributes

Supertypes
class ParseableOption[Int]
trait Parseable[Option[Int]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionLocalDate extends ParseableOption[LocalDate]

Attributes

Supertypes
class ParseableOption[LocalDate]
trait Parseable[Option[LocalDate]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionLong extends ParseableOption[Long]

Attributes

Supertypes
class ParseableOption[Long]
trait Parseable[Option[Long]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionPath extends ParseableOption[Path]

Attributes

Supertypes
class ParseableOption[Path]
trait Parseable[Option[Path]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionShort extends ParseableOption[Short]

Attributes

Supertypes
class ParseableOption[Short]
trait Parseable[Option[Short]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionString extends ParseableOption[String]

Attributes

Supertypes
class ParseableOption[String]
trait Parseable[Option[String]]
class Object
trait Matchable
class Any
Self type
object ParseableOptionURL extends ParseableOption[URL]

Attributes

Supertypes
class ParseableOption[URL]
trait Parseable[Option[URL]]
class Object
trait Matchable
class Any
Self type