In Scala you can do this pretty neatly:
url match {
case GitHubUrl => config.github
case TwitterUrl => config.twitter
case _ => defaultUrl
}