protected void setFieldValue ( String value ) { try { // filter property value value = filterValue ( value ) ; // coerce value to field type Class < ? > type = fieldInstance . getField ( ) . getType ( ) ; PropertyEditor editor = PropertyEditors . findEditor ( type ) ; editor . setAsText ( value ) ; Object coerced = editor . getValue ( ) ; // bind value to field fieldInstance . set ( coerced ) ; } catch ( IllegalAccessException e ) { throw new PropertyException ( e ) ; } }
Coerce and set specified value to field .