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:26:41 UTC

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

Jochen Kemnade created TAP5-2572:
------------------------------------

             Summary: 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)