private void throwCircularDependenciesException ( ) throws CircularDependenciesException { String msg = "Circular dependencies found. Check the circular graph below:\n" ; boolean firstNode = true ; String tab = " " ; for ( String visit : visitedInjectNodes ) { if ( ! firstNode ) { msg += tab + "->" ; tab += tab ; } msg += visit + "\n" ; firstNode = false ; } msg += tab . substring ( 2 ) + "->" + revisitedNode + "\n" ; throw new CircularDependenciesException ( msg ) ; }
Print readable circular graph