1

With @Provides annotation, I am curious what is the function name requirement.

@Provides
TypeA ProvideTypeA()
{
...
return TypeA
}

Is it OK to use a different function name?

@Provides
TypeA AnyName()
{
...
return TypeA
}
derek
  • 9,358
  • 11
  • 53
  • 94

1 Answers1

4

The name is totally unimportant

You may call your method foo, provideFoo or anyNameThatYouWant, it won't matter.

The things that matter are the return-type, parameter-types and the binding annotations (if any, in addition to @Provides).

Olivier Grégoire
  • 33,839
  • 23
  • 96
  • 137