lviggiano/owner — pull request #103 by dw-wcheng (2014-10-15 14:08:06+00:00)
Title: Added ability to allow config annotations being specified in a super config interface class

The design of OWNER config class assumes the config class is managed by the application developer. This is true for most cases, but in our use case, we are implementing configuration management in a core library to encapsulate the implementation details. Our configuration file hierarchy has a set of overriding files in different directories, along with an initial value manifest file. If developers would have to specify these files as @Sources in their code, it would mean that implementation details is leaked throughout the code base.

My first attempt was to add @Inherited to Config.Sources but quickly realize that @Inherited would only work for classes but not interfaces. My second attempt to subclass from OWNER is not feasible as classes are either final or not public. Therefore I have come up with the solution in this pull request, relying on java reflective library. Logic is quite simple, if the current interface class has the @Sources specified, use it. Otherwise recursively calling the parent until the first @Sources annotation is detected, which will be used. The same logic is extended to @LoadPolicy and @HotReload.