You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by francisco treacy <fr...@gmail.com> on 2009/04/02 17:40:53 UTC

pageparameters only allows strings?

i presume this has changed as of 1.4-rc2:

	/**
	 * @see org.apache.wicket.util.value.ValueMap#put(java.lang.String,
java.lang.Object)
	 */
	@Override
	public Object put(String key, Object value)
	{
		if ((value == null) || (value instanceof String) || (value
instanceof String[]))
		{
			return super.put(key, value);
		}
		else
		{
			throw new IllegalArgumentException("You tried to add an object of type " +
				value.getClass().getName() + "to your PageParameters for key " + key +
				", but you are only allowed to use String or String[].");
		}
	}


does somebody know why this has changed?

i don't see why it should no longer accept for example Longs (we use a
fair amount of params.put("id", long_id)), but there may be a good
reason.

i understand extending ValueMap can't give us type safety, i.e. can't
avoid put(String key, Object value) ... but maybe using composition
instead of inheritance? or in that 'if' allow primitive types as well?

anyway, no biggie but just wondering.

francisco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: pageparameters only allows strings?

Posted by francisco treacy <fr...@gmail.com>.
yup, WICKET-2162.

i confirm this has been reverted in trunk. thanks :)

francisco


2009/4/2 James Carman <jc...@carmanconsulting.com>:
> This has been fixed in the trunk as far as I know.  I brought it up
> and even filed a JIRA I believe.  It burned me too. :)
>
> On Thu, Apr 2, 2009 at 11:40 AM, francisco treacy
> <fr...@gmail.com> wrote:
>> i presume this has changed as of 1.4-rc2:
>>
>>        /**
>>         * @see org.apache.wicket.util.value.ValueMap#put(java.lang.String,
>> java.lang.Object)
>>         */
>>        @Override
>>        public Object put(String key, Object value)
>>        {
>>                if ((value == null) || (value instanceof String) || (value
>> instanceof String[]))
>>                {
>>                        return super.put(key, value);
>>                }
>>                else
>>                {
>>                        throw new IllegalArgumentException("You tried to add an object of type " +
>>                                value.getClass().getName() + "to your PageParameters for key " + key +
>>                                ", but you are only allowed to use String or String[].");
>>                }
>>        }
>>
>>
>> does somebody know why this has changed?
>>
>> i don't see why it should no longer accept for example Longs (we use a
>> fair amount of params.put("id", long_id)), but there may be a good
>> reason.
>>
>> i understand extending ValueMap can't give us type safety, i.e. can't
>> avoid put(String key, Object value) ... but maybe using composition
>> instead of inheritance? or in that 'if' allow primitive types as well?
>>
>> anyway, no biggie but just wondering.
>>
>> francisco
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: pageparameters only allows strings?

Posted by James Carman <jc...@carmanconsulting.com>.
This has been fixed in the trunk as far as I know.  I brought it up
and even filed a JIRA I believe.  It burned me too. :)

On Thu, Apr 2, 2009 at 11:40 AM, francisco treacy
<fr...@gmail.com> wrote:
> i presume this has changed as of 1.4-rc2:
>
>        /**
>         * @see org.apache.wicket.util.value.ValueMap#put(java.lang.String,
> java.lang.Object)
>         */
>        @Override
>        public Object put(String key, Object value)
>        {
>                if ((value == null) || (value instanceof String) || (value
> instanceof String[]))
>                {
>                        return super.put(key, value);
>                }
>                else
>                {
>                        throw new IllegalArgumentException("You tried to add an object of type " +
>                                value.getClass().getName() + "to your PageParameters for key " + key +
>                                ", but you are only allowed to use String or String[].");
>                }
>        }
>
>
> does somebody know why this has changed?
>
> i don't see why it should no longer accept for example Longs (we use a
> fair amount of params.put("id", long_id)), but there may be a good
> reason.
>
> i understand extending ValueMap can't give us type safety, i.e. can't
> avoid put(String key, Object value) ... but maybe using composition
> instead of inheritance? or in that 'if' allow primitive types as well?
>
> anyway, no biggie but just wondering.
>
> francisco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org