public TextWriterWriterInterface < ? > getWriterFor ( Object o ) { if ( o == null ) { return null ; } TextWriterWriterInterface < ? > writer = writers . getHandler ( o ) ; if ( writer != null ) { return writer ; } try { final Class < ? > decl = o . getClass ( ) . getMethod ( "toString" ) . getDeclaringClass ( ) ; if ( decl == Object . class ) { return null ; // TODO: cache this, too } writers . insertHandler ( decl , fallbackwriter ) ; return fallbackwriter ; } catch ( NoSuchMethodException | SecurityException e ) { return null ; } }
Retrieve an appropriate writer from the handler list .