Hi,

I'm new to Freemarker and I'm looking for the right solution for
something I ran into but have not been able to figure out.

If I have a Java class like this:

public static class Team {
    private final String name;
    public Team(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
}

If I then make a TemplateTest like this

@Test
public void testTeamName() throws Exception {
    Team team = new Team("Working");
    addToDataModel("team", team);
    assertEquals("Working", team.getName());
    assertOutput("${team.name}","Working");
}

and it all works.
If I change my Team to be a subclass of a well known collection (I have
tried TreeMap, TreeSet and ArrayList) then my .name attribute is no longer
available in a template.

public static class TeamSet extends TreeSet<User> {


What is the proper way to solve this?
Perhaps a custom Object Wrapper?
Or is this something I should report as a bug?

Thanks.

Niels Basjes
nielsbas...@apache.org
ni...@basjes.nl

Reply via email to