void write ( GinjectorBindings bindings ) throws UnableToCompleteException { TypeLiteral < ? > ginjectorInterface = bindings . getGinjectorInterface ( ) ; String implClassName = ginjectorNameGenerator . getClassName ( bindings ) ; if ( implClassName . contains ( "." ) ) { errorManager . logError ( "Internal error: the injector class name \"%s\" contains a full stop." , implClassName ) ; } String packageName = ReflectUtil . getUserPackageName ( TypeLiteral . get ( bindings . getModule ( ) ) ) ; PrintWriter printWriter = ctx . tryCreate ( logger , packageName , implClassName ) ; if ( printWriter == null ) { // We already created this Ginjector. return ; } ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory ( packageName , implClassName ) ; SourceWriter writer = composerFactory . createSourceWriter ( ctx , printWriter ) ; FragmentMap fragments = new FragmentMap ( bindings , packageName , implClassName , fragmentOutputterFactory ) ; outputBindings ( bindings , fragments , writer ) ; errorManager . checkForError ( ) ; fragments . commitAll ( ) ; writer . commit ( logger ) ; }
Writes the Ginjector class for the given bindings object and all its package - specific fragments .