-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
The @ServiceProvider annotation should be expanded to allow annotation without needing to specify the contract.
Why is this needed?
Simpler syntax allows developers to come up to speed with the library quicker, and allows for faster development.
Proposed solution
Proposed syntax:
@ServiceContract
interface SomeContract {
fun doSomething()
}
@ServiceProvider
class DefaultSomeContract : SomeContract {
override fun doSomething() = Unit
}The class(es) can be deterministically found via exploring the interfaces that parent the implementation and checking if they have @ServiceContract.
The annotation should still allow for manual specification of contracts to ensure conflicts do not occur:
@ServiceContract
interface SomeContractA {
fun doSomething(): String
}
@ServiceContract
interface SomeContractB {
fun doSomethingElse(): String
}
@ServiceProvider(SomeContractB::class)
class DefaultSomething :
SomeContractA, // We do not want to generate a service for this contract for this implementation
SomeContractB {
override fun doSomething(): String {
return "Hello"
}
override fun doSomethingElse(): String {
return doSomething() + " World!"
}
}
@ServiceProvider
class AnotherSomething : SomeContractA {
override fun doSomething(): String {
return "Hello World"
}
}Checklist
- I have searched existing issues to avoid duplicates
Reactions are currently unavailable