Created
January 18, 2011 00:39
-
-
Save wfaler/783798 to your computer and use it in GitHub Desktop.
WidgetTransformer.scala
This file contains hidden or 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
/** | |
* Transforms from single request parameters to an object, for instance in this case from a Widget ID | |
* to an Actual Widget, or returns None if a transformation cannot be done.<br/> | |
* Must be registered with the TransformerRegistry, as done in the bootstrap above. | |
*/ | |
class WidgetTransformer extends StringValueTransformer[Widget]{ | |
def toValue(from: String): Option[Widget] = Widgets.find(Integer.parseInt(from)) | |
} |
Good catch, I have no idea why it's been done that way. Brain meltdown. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can be replaced with
Also, do you really mean to use the return keyword? Perhaps your intention is simply: