[ https://issues.apache.org/jira/browse/WICKET-1596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595826#action_12595826 ]
Johan Compagner commented on WICKET-1596: ----------------------------------------- applied > New convenience methods for ValueMap (code and tests included!) > --------------------------------------------------------------- > > Key: WICKET-1596 > URL: https://issues.apache.org/jira/browse/WICKET-1596 > Project: Wicket > Issue Type: Improvement > Components: wicket > Affects Versions: 1.4-M1 > Environment: Any > Reporter: Doug Donohoe > Assignee: Johan Compagner > Fix For: 1.4-M2 > > Attachments: valuemap.v2.patch > > Original Estimate: 0.17h > Remaining Estimate: 0.17h > > Methods to get values out of PageParameters (aka ValueMap) as first class > Objects (Boolean, Integer, Double, Long, Time, Duration) and to get the same > values as primitives if default values are provided without having to worry > about StringConversion exceptions. > This allows one to do: > Integer id = params.getAsInteger("id") > And not have to worry if id is missing or someone tried to hack the query > string by passing in an non-numeric value. Also, it allows you to check for > null without passing in a default value you hope never occurs in practice. > Also allows you to get Enumerated values as page params. > public enum TestEnum { > one, two, three > } > ValueMap vm = new ValueMap(); > vm.put("myenum", "one"); > TestEnum test = vm.getAsEnum("myenum", TestEnum.class, TestEnum.three); > I have this code done with test cases and a patch ready. I'll see if I can > upload it after I create this issue. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.