david
david

Reputation: 1

How to make IReport access a get method stack on a Javabean datasource

I have a Bean with some properties that is a reference for another Bean and I would like to show in my report some property of the property of the bean through its corresponding get method.

For example:

class Person {
    private Address ad;

    public Address getAddress() {
        return this.ad;
    }
}

class Address {
    private String city;

    public String getCity() {
        return this.city
    }
}

I would like pass as a DataSource for the report a Collection of Person and I would like to create a field in the report to show the city of the address of each Person in the collection.

Upvotes: 0

Views: 992

Answers (1)

Alex K
Alex K

Reputation: 22867

You can declare fields like this:

<field name="city" class="java.lang.String">
    <fieldDescription><![CDATA[person.address.city]]></fieldDescription>
</field>

Upvotes: 3

Related Questions