private void setPropertyValue ( Object pObj , String pProperty , Object pValue ) { Method m = null ; Class [ ] cl = { pValue . getClass ( ) } ; try { //Util.setPropertyValue(pObj, pProperty, pValue); // Find method m = pObj . getClass ( ) . getMethod ( "set" + StringUtil . capitalize ( pProperty ) , cl ) ; // Invoke it Object [ ] args = { pValue } ; m . invoke ( pObj , args ) ; } catch ( NoSuchMethodException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException iae ) { iae . printStackTrace ( ) ; } catch ( InvocationTargetException ite ) { ite . printStackTrace ( ) ; } }
Sets the property value to an object using reflection