You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Joseph Pachod <jo...@thomas-daily.de> on 2010/06/17 23:13:49 UTC

inconsistency in property expression when using . for self reference

hi

Let's consider this class :
class Container {
        String string = "foo";

        List<String> strings = Arrays.asList(new String[]{"test"});
    }

This would work:
new PropertyModel<String>(container, ".string").getObject()
=> returns "foo"

but this doesn't:
new PropertyModel<String>(container, ".strings[0]").getObject()
it fails with
org.apache.wicket.WicketRuntimeException: no get method defined for class: class org.demo.PropertyModelTest$Container expression: strings

Similarly, this doesn't work:
new PropertyModel<Container>(container, ".").getObject()
exception is :java.lang.StringIndexOutOfBoundsException: String index out of range: 0


In the end, should the dot being allowed for self reference ? It's already used as the property separator, so it would be quite misleading.

I've attached some proper junit test for these points.

++
joseph

Re: inconsistency in property expression when using . for self reference

Posted by Joseph Pachod <jp...@thomas-daily.de>.
Jeremy Thomerson wrote:
> Please attach to a JIRA [https://issues.apache.org/jira/browse/WICKET] so
> that it doesn't get lost.
>   

done : https://issues.apache.org/jira/browse/WICKET-2919

++

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


Re: inconsistency in property expression when using . for self reference

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Please attach to a JIRA [https://issues.apache.org/jira/browse/WICKET] so
that it doesn't get lost.

On Thu, Jun 17, 2010 at 4:13 PM, Joseph Pachod <josephpachod@thomas-daily.de
> wrote:

>  hi
>
> Let's consider this class :
> class Container {
>         String string = "foo";
>
>         List<String> strings = Arrays.asList(new String[]{"test"});
>     }
>
> This would work:
> new PropertyModel<String>(container, ".string").getObject()
> => returns "foo"
>
> but this doesn't:
> new PropertyModel<String>(container, ".strings[0]").getObject()
> it fails with
> org.apache.wicket.WicketRuntimeException: no get method defined for class:
> class org.demo.PropertyModelTest$Container expression: strings
>
> Similarly, this doesn't work:
> new PropertyModel<Container>(container, ".").getObject()
> exception is :java.lang.StringIndexOutOfBoundsException: String index out
> of range: 0
>
>
> In the end, should the dot being allowed for self reference ? It's already
> used as the property separator, so it would be quite misleading.
>
> I've attached some proper junit test for these points.
>
> ++
> joseph
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Jeremy Thomerson
http://www.wickettraining.com