0
我使用APT(注释处理器)创建代理类,以在原始类中执行一些检测。更改绑定到代理
我想用此代理更改Dagger 2中的绑定,而不是使用@MyCustomAnnotation注释实现类时的默认实现。
实现(通过用户):
@MyCustomAnnotation
public class MyServiceImpl implements MyService {
// Implementation
}
原始模块:
@Module
public class AppModule {
@Provides
@Singleton
MyService providesService() {
return new MyServiceImpl();
}
}
最终模块替换的实现:
@Module
public class AppModule {
@Provides
@Singleton
MyService providesService() {
return new MyServiceImplProxy();
}
}
我需要从用户的角度东西透明。
你们有什么建议?