You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2017/02/14 10:28:41 UTC

[jira] [Commented] (TAP5-2572) Duplicate properties in bean model

    [ https://issues.apache.org/jira/browse/TAP5-2572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865540#comment-15865540 ] 

Jochen Kemnade commented on TAP5-2572:
--------------------------------------

The {{isBar}} property is added by the Scala property detection algorithm.

> Duplicate properties in bean model
> ----------------------------------
>
>                 Key: TAP5-2572
>                 URL: https://issues.apache.org/jira/browse/TAP5-2572
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: beanmodel
>    Affects Versions: 5.4.1
>            Reporter: Jochen Kemnade
>
> If you create a BeanModel for a class with a private field that has the same name as a getter method, you end up with two properties:
> {code:java}
> package org.example;
> import java.util.Collections;
> import java.util.Locale;
> import org.apache.tapestry5.beaneditor.BeanModel;
> import org.apache.tapestry5.beaneditor.BeanModelSourceBuilder;
> import org.apache.tapestry5.internal.services.MapMessages;
> import org.apache.tapestry5.services.BeanModelSource;
> public class Foo {
>   private boolean isBar;
>   public boolean isBar() {
>     return isBar;
>   }
>   public static void main(final String[] args) {
>     BeanModelSource bms = new BeanModelSourceBuilder().build();
>     BeanModel<Foo> model = bms.createDisplayModel(Foo.class, new MapMessages(Locale.US, Collections.emptyMap()));
>     System.out.println(model.getPropertyNames());
>   }
> }
> {code}
> The output is {{ [bar, isBar] }}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)