Reputation: 211
I'm using IReport (JasperStudio plugin for Eclipse) and I'm trying to create a report with a JavaBean as source.
Suppose I have these two classes:
public class MyClass {
private String myClassAttribute;
// getter and setter for myClassAttribute
}
public class AnotherMyClass {
private String anotherMyClassAttribute;
private MyClass myClass;
// getter and setter for anotherMyClassAttribute
// getter and setter for myClass
}
If I choose AnotherMyClass as JavaBeanSource I can set only fields from that class (anotherMyClassAttribute), I didn't find a way to set a text to getMyClass().getmyClassAttribute().
Do JavaBeans stop at level one or is there a way to use attribute from other classes between references?
Thanks.
Upvotes: 0
Views: 491
Reputation: 933
In report define field $F{myClass} with type MyClass
In text field use expression $F{myClass}.getMyClassAttribute()
Upvotes: 1
Reputation: 677
No, it doesn't stop at level one, you may go as deep as you want. You may use the attribute like myClass.myClassAttribute
. And for setting a value to it, myClass.myClassAttribute = "some value"
Upvotes: 0