Problem with default values (issue 3)

3 views
Skip to first unread message

Daniel Toffetti

unread,
Jul 20, 2010, 11:38:07 PM7/20/10
to Wicket Web Beans
Hi all,

In the parameters reference wiki page:

http://code.google.com/p/wicket-web-beans/wiki/ParameterReference

we can see the description of the standard property parameter
"defaultValue".

Now, on the enumerated types wiki page:

http://code.google.com/p/wicket-web-beans/wiki/EnumeratedTypes

we see this example:

# Enum Bean Example
Customer {
cols: 1;
props:
firstName, lastName,
customerType{default: Government};
}

Here, .beanprops file is configuring the enum property
CustomerType with the parameter "default". This actually works
with .beanprops files because the EnumField is consuming that
parameter (EnumField.java, line 156):

String defaultChoice =
getElementMetaData().getParameter("default");

Now if you attempt to configure that same field with a
defaultValue parameter in a Property annotation or a JProperty
declaration, it won't work, which is precisely the problem described
in Issue 3:

http://code.google.com/p/wicket-web-beans/issues/detail?id=3

To fix this issue the consumed parameter in EnumField must be
corrected, this also implies fixing two examples (Enums and
CustomFields) and also fixing the EnumeratedTypes wiki page.
This can also possibly break existing apps that are currently
configured using the "default" parameter in the .beanprops file,
that's why I ask before committing.

Should I proceed ?

Daniel

Dan Syrstad

unread,
Jul 21, 2010, 2:15:20 PM7/21/10
to wicket-w...@googlegroups.com
I'd say you should proceed. Sounds like a bug to me. I think "defaultValue" was used on the annotations because "default" is a Java keyword.

Maybe try to consume both parameters ("default" and "defaultValue") in EnumField. Give "defaultValue" precedence if both are present. This should preserve backwards compatibility.
-Dan


--
You received this message because you are subscribed to the Google Groups "Wicket Web Beans" group.
To post to this group, send email to wicket-w...@googlegroups.com.
To unsubscribe from this group, send email to wicket-web-bea...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wicket-web-beans?hl=en.


Daniel Toffetti

unread,
Aug 9, 2010, 10:28:21 AM8/9/10
to Wicket Web Beans
Committed, now defaultValue takes precedence but default is still
supported. Fixed the wiki also to reflect the changes.

Daniel
Reply all
Reply to author
Forward
0 new messages