Child pages
  • adding a to-many relationship

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This means you can create and access fields in your Jasper .jrxml  firstName and lastName, you do not need to create the getFirstName and getLastName accessors!

 

Code Block
 
import java.beans.IntrospectionException;

...


import java.beans.PropertyDescriptor;

...


import java.beans.SimpleBeanInfo;

...


import java.util.ArrayList;

...


import java.util.List;

...


public class PersonBeanInfo extends SimpleBeanInfo {

...



 @Override
 public PropertyDescriptor[] getPropertyDescriptors() {

...



 try {

...


 List<PropertyDescriptor> list = new ArrayList<>();

...


list.add( new PropertyDescriptor( "firstName", Person.class, "firstName", "setFirstName" ) );

...


list.add( new PropertyDescriptor( "lastName", Person.class, "lastName", "setLastName" ) );

...


PropertyDescriptor[] array = new PropertyDescriptor[list.size()];

...


 array = list.toArray( array );

...


 return array;

...


 }

...


 catch( IntrospectionException e ) {

...


 throw new RuntimeException( e );

...


 }

...


 }

...


}