Created
March 18, 2013 16:58
-
-
Save saml/5188782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class MenuItemPortion(title: String, price: String) | |
object MenuItemPortion extends Convertable[MenuItemPortion] { | |
override def readFrom(dbo: MongoDBObject): Option[MenuItemPortion] = { | |
val title: Option[String] = dbo.getAs[String]("title") | |
val price: Option[String]= dbo.getAs[String]("price") | |
if (title.isEmpty && price.isEmpty) None | |
else Some(MenuItemPortion(title.getOrElse(""), price.getOrElse(""))) | |
} | |
} |
jsuereth
commented
Mar 18, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment