protected void initializeField ( Field field , Object instance ) { if ( instance != null ) { if ( _log . isTraceEnabled ( ) ) { _log . trace ( "Initializing field " + field . getName ( ) + " in " + getDisplayName ( ) + " with " + instance ) ; } try { field . set ( this , instance ) ; } catch ( IllegalArgumentException e ) { _log . error ( "Could not set field " + field . getName ( ) + " on " + getDisplayName ( ) + "; instance is of type " + instance . getClass ( ) . getName ( ) + ", field type is " + field . getType ( ) . getName ( ) ) ; } catch ( IllegalAccessException e ) { _log . error ( "Error initializing field " + field . getName ( ) + " in " + getDisplayName ( ) , e ) ; } } }
Initialize the given field with an instance . Mainly useful for the error handling .