Referencing a bean
To declare a field that references the bean itself instead of one of its properties, set the field description to the keyword _THIS
.
<field name="myJavaBean" class="com.your.package.MyJavaBean">
<fieldDescription>_THIS</fieldDescription>
</field>
You can then pass this as a subreport parameter like any other field.
<subreportParameter name="myJavaBean">
<subreportParameterExpression>
<![CDATA[$F{myJavaBean}]]>
</subreportParameterExpression>
</subreportParameter>
Methods in the bean can be called in the normal way, i.e: $F{myJavaBean}.someMethod()
Referencing a single element of the collection
Depending on what you are doing here it could be more difficult. If you want to only see the detail for the single element, set the printWhenExpression
on the band to the key of the element you want. However, if you want to have some report elements reference one object in the collection while the rest of the band references another, it would probably be better for you to nest another subreport within the detail band.