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 optionalStringParseableOptionBoolean: Parses optionalBooleanParseableOptionByte: Parses optionalByteParseableOptionShort: Parses optionalShortParseableOptionInt: Parses optionalIntParseableOptionFloat: Parses optionalFloatParseableOptionDouble: Parses optionalDoubleParseableOptionLong: Parses optionalLongParseableOptionBigInt: Parses optionalBigIntParseableOptionBigDecimal: Parses optionalBigDecimalParseableOptionLocalDate: Parses optionalLocalDateParseableOptionURL: Parses optionaljava.net.URLParseableOptionFile: Parses optionaljava.io.File
Attributes
- Companion
- class
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ParseableOption.type
Members list
Type members
Classlikes
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
-
ParseableOptionByte.type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
-
ParseableOptionFile.type
Attributes
- Supertypes
- Self type
-
ParseableOptionFloat.type
Attributes
- Supertypes
- Self type
-
ParseableOptionInt.type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
-
ParseableOptionLong.type
Attributes
- Supertypes
- Self type
-
ParseableOptionPath.type
Attributes
- Supertypes
- Self type
-
ParseableOptionShort.type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Self type
-
ParseableOptionURL.type