Jump to content

Referencing using binary name


marcosamba

Recommended Posts

Trying to compile a jrxml file I'm having the following exception:

TheÂnestedÂtype org.example.ClassA$ClassB cannot be referencedÂusingÂitsÂbinaryÂname

Class B is a static inner class of Class A and I want to access to a (non static) property of type ClassB present in ClassA using a (non static) getter method:

public ClassA {

private ClassA.ClassB propB;

public ClassA.ClassB getPropB() {
return propB;
}

public static class ClassB {
...
}

}

Why do I get the excpetion? What can I do to avoid it?

Thanks.
Marco.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I've prepared a basic example because the real case is quite complex.

Consider to use a JRBeanCollectionDataSource as Datasource for the report. The Beans are of type ChildB, you can use IReportBeansFactory as factory class to use in iReport (method getChildB) and the provided jrxml to test.

What I get is the following exception trying to compile the jrxml:

TheÂnestedÂtypeÂorg.example.beans.ChildB$InnerChildÂcannotÂbeÂreferencedÂusingÂitsÂbinaryÂname valueÂ=Â(java.lang.String)(""+((org.example.beans.ChildB$InnerChild)field_inner.getValue()).getDesc());//$JR_EXPR_ID=10$

Thanks,
Marco [file name=InnerClassTest.zip size=2086]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...