SHARE
TWEET

Untitled

a guest Nov 15th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class FirstValidator implements BaseValidator<String> {
  2.  
  3. @Override
  4. public boolean isValid(String string) {
  5.     // code here
  6. }
  7.    
  8. public class SecondValidator implements BaseValidator<Int> {
  9.  
  10. @Override
  11. public boolean isValid(Int string) {
  12.     // code here
  13. }
  14.    
  15. @Provides
  16. @Singleton
  17. @Named("FirstValidator")
  18. public BaseValidator<String> provideFirstValidator(){
  19.     return new FirstValidator();
  20. }
  21.  
  22. @Provides
  23. @Singleton
  24. @Named("SecondValidator")
  25. public BaseValidator<Int> provideSecondValidator(){
  26.     return new SecondValidator();
  27. }
  28.    
  29. private BaseValidator<String> mFirstValidator;
  30.  
  31. @Inject
  32. public MainPresenter(@Named("FirstValidator") BaseValidator<String> firstValidator) {
  33.     this.mFirstValidator = peselValidator;
  34. }
  35.    
  36. error: [dagger.android.AndroidInjector.inject(T)] BaseValidator<java.lang.String> cannot be provided without an @Provides-annotated method.
RAW Paste Data
Top