com.scalacraft.domain.v2

country

package country

Domain classes related to countries

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. country
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class CountryCodeA2 extends Product with Serializable

    A CountryCodeA2 represents an ISO 3166 alpha-2 country code.

    A CountryCodeA2 represents an ISO 3166 alpha-2 country code.

    Details of the ISO 3166-1 alpha 2 codes can be found here: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

    Pattern Matching

    Pattern matching is supported as illustrated by the following examples,

    "SC" match {
    case CountryCodeA2(code) => code  // "SC"
    case _ => None
    }

    Invalid country codes will not be matched.

    "GBR" match {
    case CountryCodeA2(code) => code
    case _ => None  // None
    }
    Implicit Conversions

    An implicit conversion is provided which allows an instance of CountryCodeA2 to be used when a String is required.

    def logCode(code: String) = println(s"code: $code")
    
    val cc = CountryCodeA2.opt("TV").get
    logCode(cc) // "code: TV"

    An implicit conversion to the unconstrained version of this class is also available.

  2. case class CountryCodeA3 extends Product with Serializable

    A CountryCodeA3 represents an ISO 3166 alpha-3 country code.

    A CountryCodeA3 represents an ISO 3166 alpha-3 country code.

    Details of the ISO 3166-1 alpha 3 codes can be found here: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3

    Pattern Matching

    Pattern matching is supported as illustrated by the following examples,

    "JAM" match {
    case CountryCodeA3(code) => code  // "JAM"
    case _ => None
    }

    Invalid country codes will not be matched.

    "JA" match {
    case CountryCodeA3(code) => code
    case _ => None  // None
    }
    Implicit Conversions

    An implicit conversion is provided which allows an instance of CountryCodeA3 to be used when a String is required.

    def logCode(code: String) = println(s"code: $code")
    
    val cc = CountryCodeA3.opt("TKL").get
    logCode(cc) // "code: TKL"

    An implicit conversion to the unconstrained version of this class is also available.

  3. case class CountryCodeNumeric extends Product with Serializable

    A CountryCodeNumeric represents an ISO 3166 numeric country code.

    A CountryCodeNumeric represents an ISO 3166 numeric country code.

    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,

    "343" match {
    case CountryCodeNumeric(code) => code  // "343"
    case _ => None
    }

    Invalid country codes will not be matched.

    "44" match {
    case CountryCodeNumeric(code) => code
    case _ => None  // None
    }
    Implicit Conversions

    An implicit conversion is provided which allows an instance of CountryCodeNumeric to be used when a String is required.

    def logCode(code: String) = println(s"code: $code")
    
    val cc = CountryCodeNumeric.opt("495").get
    logCode(cc) // "code: 495"

    An implicit conversion to the unconstrained version of this class is also available.

Value Members

  1. object CountryCodeA2 extends Serializable

    This object provides a set of operations needed to create and convert instances of CountryCodeA2

  2. object CountryCodeA3 extends Serializable

    This object provides a set of operations needed to create and convert instances of CountryCodeA3

  3. object CountryCodeNumeric extends Serializable

    This object provides a set of operations needed to create and convert instances of CountryCodeNumeric

  4. package unconstrained

Inherited from AnyRef

Inherited from Any

Ungrouped