Skip to content

@Binds Validation

Henry edited this page May 26, 2020 · 3 revisions
  • @Binds methods can only be present within a @Module or @ProducerModule

  • @Binds methods may not have type parameters

  • @Binds methods cannot be private

  • @Binds methods needs to be abstract

  • @Binds methods may only throw unchecked exceptions

  • @Binds methods cannot use more than one @Scope

  • @Binds methods may not use more than one @Qualifier

  • @Binds methods must return a value (not void)

  • @Binds methods must not return framework types

  • @Binds methods' parameter type must be assignable to the return type (For this case ensure MultiBinding use case, where the parameter won't be a child of parent, like Car and <Set<Vehicle>>)

  • @Binds methods must have exactly one parameter, whose type is assignable to the return type

Clone this wiki locally