public String createMemberInjection ( TypeLiteral < ? > type , NameGenerator nameGenerator , List < InjectorMethod > methodsOutput ) throws NoSourceNameException { String memberInjectMethodName = nameGenerator . getMemberInjectMethodName ( type ) ; String memberInjectMethodSignature = "public void " + memberInjectMethodName + "(" + ReflectUtil . getSourceName ( type ) + " injectee)" ; SourceSnippetBuilder sb = new SourceSnippetBuilder ( ) ; sb . append ( createFieldInjections ( getFieldsToInject ( type ) , "injectee" , nameGenerator , methodsOutput ) ) ; sb . append ( createMethodInjections ( getMethodsToInject ( type ) , "injectee" , nameGenerator , methodsOutput ) ) ; // Generate the top-level member inject method in the package containing the // type we're injecting: methodsOutput . add ( SourceSnippets . asMethod ( false , memberInjectMethodSignature , ReflectUtil . getUserPackageName ( type ) , sb . build ( ) ) ) ; return memberInjectMethodName ; }
Generates all the required injector methods to inject members of the given type and a standard member - inject method that invokes them .