private void setupApplicationProfile( ComponentDescriptor applicationDescriptor, ASTType astType, AnalysisContext context) { ASTMethod onCreateASTMethod = getASTMethod("onCreate"); // onCreate applicationDescriptor.setInitMethodBuilder( OnCreate.class, componentBuilderFactory.buildOnCreateMethodBuilder( onCreateASTMethod, new NoOpLayoutBuilder())); applicationDescriptor.setInjectionNodeFactory( componentBuilderFactory.buildInjectionNodeFactory(astType, context)); // onLowMemory applicationDescriptor.addGenerators(buildEventMethod(OnLowMemory.class, "onLowMemory")); // onTerminate applicationDescriptor.addGenerators(buildEventMethod(OnTerminate.class, "onTerminate")); // onConfigurationChanged ASTMethod onConfigurationChangedASTMethod = getASTMethod("onConfigurationChanged", Configuration.class); applicationDescriptor.addGenerators( componentBuilderFactory.buildMethodCallbackGenerator( OnConfigurationChanged.class, componentBuilderFactory.buildMirroredMethodGenerator( onConfigurationChangedASTMethod, true))); applicationDescriptor.addGenerators(contextScopeComponentBuilder); applicationDescriptor.addRegistration(observesExpressionDecorator); }
private MethodCallbackGenerator buildEventMethod( Class<? extends Annotation> eventAnnotation, String methodName) { ASTMethod method = getASTMethod(methodName); return componentBuilderFactory.buildMethodCallbackGenerator( eventAnnotation, componentBuilderFactory.buildMirroredMethodGenerator(method, true)); }