public T getValue ( Object obj ) throws IllegalAccessException , InvocationTargetException { if ( field == null ) { @ SuppressWarnings ( "unchecked" ) T cast = ( T ) getMethod . invoke ( obj ) ; return cast ; } else { @ SuppressWarnings ( "unchecked" ) T cast = ( T ) field . get ( obj ) ; return cast ; } }
Get the value associated with this field from the object parameter either by getting from the field or calling the get method .