@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) protected Object readBean ( Object bean ) { log . debug ( "readBean: {}" , bean ) ; storeReference ( bean ) ; Class theClass = bean . getClass ( ) ; while ( hasMoreProperties ( ) ) { String name = readPropertyName ( ) ; Type type = getPropertyType ( bean , name ) ; log . debug ( "property: {} type: {}" , name , type ) ; Object property = Deserializer . deserialize ( this , type ) ; log . debug ( "val: {}" , property ) ; // log.debug("val: "+property.getClass().getName()); if ( property != null ) { try { if ( type instanceof Class ) { Class t = ( Class ) type ; if ( ! t . isAssignableFrom ( property . getClass ( ) ) ) { property = ConversionUtils . convert ( property , t ) ; } } final Field field = theClass . getField ( name ) ; field . set ( bean , property ) ; } catch ( Exception ex2 ) { try { BeanUtils . setProperty ( bean , name , property ) ; } catch ( Exception ex ) { log . error ( "Error mapping property: {} ({})" , name , property ) ; } } } else { log . debug ( "Skipping null property: {}" , name ) ; } if ( hasMoreProperties ( ) ) { skipPropertySeparator ( ) ; } else { break ; // hasMoreProperties == false, position moved to +3 } } return bean ; }
Reads the input as a bean and returns an object