private void writePreProcessor( final XmlWriter writer, final ReportPreProcessor preProcessor )
throws IntrospectionException, BeanException, IOException {
if ( writer == null ) {
throw new NullPointerException();
}
if ( preProcessor == null ) {
throw new NullPointerException();
}
final BeanUtility beanUtility = new BeanUtility( preProcessor );
final String[] propertyNames = beanUtility.getProperties();
for ( int i = 0; i < propertyNames.length; i++ ) {
final String key = propertyNames[i];
final Object property = beanUtility.getProperty( key );
final Class propertyType = beanUtility.getPropertyType( key );
final String value = beanUtility.getPropertyAsString( key );
if ( value != null && property != null ) {
final AttributeList attList = new AttributeList();
attList.setAttribute( BundleNamespaces.LAYOUT, "name", key );
if ( BeanUtility.isSameType( propertyType, property.getClass() ) == false ) {
attList.setAttribute( BundleNamespaces.LAYOUT, "class", property.getClass().getName() );
}
writer.writeTag( BundleNamespaces.LAYOUT, "property", attList, XmlWriterSupport.OPEN );
writer.writeTextNormalized( value, false );
writer.writeCloseTag();
}
}
}