com.scalacraft.domain.v2.country.unconstrained
A CountryCodeNumeric represents an ISO 3166 numeric country code.
CountryCodeNumeric
This class does not constrain the value of the code in anyway.
Details of the ISO 3166-1 numeric codes can be found here: http://en.wikipedia.org/wiki/ISO_3166-1_numeric
Pattern matching is supported as illustrated by the following examples,
"419" match { case CountryCodeNumeric(code) => code // "419" case _ => None }
Invalid country codes will be matched.
"B*" match { case CountryCodeNumeric(code) => code // "B*" case _ => None }
An implicit conversion is provided which allows an instance of CountryCodeNumeric to be used when a String is required.
String
def logCode(code: String) = println(s"code: $code") val cc = CountryCodeNumeric("415") logCode(cc) // "code: 415"
An implicit conversion to the constrained version of this class is also available.
A value which can be a valid or invalid numeric country code
A
CountryCodeNumericrepresents an ISO 3166 numeric country code.This class does not constrain the value of the code in anyway.
Details of the ISO 3166-1 numeric codes can be found here: http://en.wikipedia.org/wiki/ISO_3166-1_numeric
Pattern Matching
Pattern matching is supported as illustrated by the following examples,
Invalid country codes will be matched.
Implicit Conversions
An implicit conversion is provided which allows an instance of
CountryCodeNumericto be used when aStringis required.An implicit conversion to the constrained version of this class is also available.
A value which can be a valid or invalid numeric country code