at class declaration level instead of directly above the
service() method.
Can I do this?
No. Well, I should be more clear and say, "You can, but they won't be read".
OK, then this will mean overiding service() in order to add the dependency tags there. Could we make it so that dependency tags defined at class declaration level are read or is there a specific reason why not to do this? (I can think of the fact that in order for the dependency tags to have meaning the component should be Serviceable.)
The dependency tags only have meaning if the component is Serviceable. There were some other considerations as well.
If we put everything into the class Javadocs, then there are a couple of other issues:
* Many components directly look up the components they need in the service() method. It's always good to have the info right there.
* If everything was in the class level Javadocs, that will be overloaded with lines and lines of info before you get to the code.
* Nine times out of ten, if you extend a class that is Serviceable you are not adding new dependencies to the list.
Currently, the service(ServiceManager) method is what the meta info gathering tool looks like. I can make a code change to determine the dependency list by examining for legacy interfaces like the Composer interface.
While I am at it, I could probably determine the full set of dependencies for a component by gathering that information from the parent component's file....
The following link provides an overview of how Fortress looks for meta info:
http://avalon.apache.org/excalibur/fortress/api/org/apache/avalon/fortress/impl/role/ServiceMetaManager.html
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin