Grails object marshalling - adding data type hints?
I'd like to be able to have something like this:
<form>
<input type="date" name="params.date"/>
<input type="text" name="params.myString"/>
</form>
And marshall this to
Map<String, Object> params
['date': (Date object),
'myString': (String)]
inside of a command object holder as such:
class Holder{
def params
def unshownAttributes
}
I thought about doing some hackery involving javascript to parse out a data-type
HTML5 attribute and prepren开发者_C百科ding the name (and fixing up the types later), but I was hoping there was a better way to do this automatically with groovy or grails.
Any thoughts?
No such mechanism currently exists. You may save yourself some pain by just creating methods for every marshalling instance you need with proper command objects.
精彩评论