OK, I think that you can really use annotations to mark ranges of versions that should expose the API. For example if method foo()
was introduced in version 1.1. and deprecated in version 1.5 you can mark it as following:
class MyApiImpl { @Since("1.2") @DeprecateAt("1.4") @Until("1.5") foo(); }
Then you can automatically generate interface interface MyApi
according to client version:
- for client prior version 1.2 this method will not be included into the interface.
- for client between versions 1.2 and 1.4 it will be included
- for client version 1.4 it will be included but marked as
@Deprecated
- it will not be included for clients after 1.5