public Reflect set ( String fieldName , Object value ) throws ReflectionException { Field field = null ; boolean isAccessible = false ; try { if ( hasField ( fieldName ) ) { field = getField ( fieldName ) ; isAccessible = field . isAccessible ( ) ; field . setAccessible ( accessAll ) ; } else { throw new NoSuchElementException ( ) ; } value = convertValueType ( value , field . getType ( ) ) ; field . set ( object , value ) ; return this ; } catch ( IllegalAccessException e ) { throw new ReflectionException ( e ) ; } finally { if ( field != null ) { field . setAccessible ( isAccessible ) ; } } }
Sets the value of a field . Will perform conversion on the value if needed .