protected void injectMultipleDependencies(@Bean EmptyDependency multiDependency, @Bean(SomeImplementation.class) SomeInterface multiDependencyInterface, @Bean SomeSingleton multiDependencySingleton) { this.multiDependency = multiDependency; this.multiDependencyInterface = multiDependencyInterface; this.multiDependencySingleton = multiDependencySingleton; } }
@Bean protected void injectDependency(EmptyDependency methodInjectedDependency) { this.methodInjectedDependency = methodInjectedDependency; }
protected void injectDependencyAnnotatedParam(@Bean EmptyDependency annotatedParamDependency) { this.annotatedParamDependency = annotatedParamDependency; }
@Bean(SomeImplementation.class) protected void injectInterface(SomeInterface methodInjectedInterface) { this.methodInjectedInterface = methodInjectedInterface; }
@Bean protected void injectSingleton(SomeSingleton methodInjectedSingleton) { this.methodInjectedSingleton = methodInjectedSingleton; }
protected void injectSingletonAnnotatedParam(@Bean SomeSingleton annotatedParamSingleton) { this.annotatedParamSingleton = annotatedParamSingleton; }
protected void injectInterfaceAnnotatedParam(@Bean(SomeImplementation.class) SomeInterface annotatedParamInterface) { this.annotatedParamInterface = annotatedParamInterface; }
@EActivity(R.layout.main) public class AfterViewsActivity extends Activity { @Bean AfterViewBean afterViewBean; public boolean afterViewBeanCalledBefore = false; @AfterViews void afterViews() { afterViewBeanCalledBefore = afterViewBean.afterViewsCalled; } }
@EApplication public class SampleRoboApplication extends Application { @Bean public EmptyDependency someDependency; }
@EFragment public abstract class AbstractFragment extends Fragment { @Bean SomeBean someBean; }
@EBean(scope = EBean.Scope.Singleton) public class SomeCyclicSingletonA { @Bean SomeCyclicSingletonB singletonB; }
@EBean(scope = EBean.Scope.Singleton) public class SomeCyclicSingletonB { @Bean SomeCyclicSingletonA singletonA; }
@EIntentService public class MyIntentService extends AbstractIntentService { @Bean EnhancedClass dependency; public MyIntentService() { super(MyIntentService.class.getSimpleName()); } @ServiceAction void myAction() { } @ServiceAction void actionOne(String valueString) { } @ServiceAction("myAction") void actionThree(String valueString, long valueLong) { } }
@Bean EnhancedClass dependency;
@EReceiver public class MyReceiver extends BroadcastReceiver { @SystemService NotificationManager notificationManager; @Bean EnhancedClass dependency; @Override public void onReceive(Context context, Intent intent) { showToast(context); workInBackground(); } @Trace @UiThread void showToast(Context context) { Toast.makeText(context, "Hello World!", Toast.LENGTH_LONG).show(); } @Trace @Background void workInBackground() { Log.d(MyService.class.getSimpleName(), "Doing some background work."); } }
@EBean(scope = Scope.Singleton) public class SomeSingleton { @RootContext public Context context; /* * Should not be injected (singleton) */ @ViewById public View myTextView; @Bean public BeanWithView beanWithView; }
NotificationManager notificationManager; @Bean EnhancedClass dependency;