question: protected Object convertValueFromXml ( Class type , Object value ) { if ( value instanceof String && type . isPrimitive ( ) ) { String tmp = ( String ) value ; if ( type . equals ( boolean . class ) ) { if ( tmp . equals ( "1" ) || tmp . equals ( "0" ) ) { tmp = ( tmp . equals ( "1" ) ) ? "true" : "false" ; } value = new Boolean ( tmp ) ; } else if ( type . equals ( char . class ) ) { value = new Character ( tmp . charAt ( 0 ) ) ; } else if ( type . equals ( byte . class ) ) { value = new Byte ( tmp ) ; } else if ( type . equals ( short . class ) ) { value = new Short ( tmp ) ; } else if ( type . equals ( int . class ) ) { value = new Integer ( tmp ) ; } else if ( type . equals ( long . class ) ) { value = new Long ( tmp ) ; } else if ( type . equals ( float . class ) ) { value = new Float ( tmp ) ; } else if ( type . equals ( double . class ) ) { value = new Double ( tmp ) ; } } return value ; }
target:  Converts XML attribute values to object of the given type.