Jose Alberto Fernandez wrote: > This is exactly the point, we should try to type things. Roles
Why ? We have components that can be used in any role. Metadata can be extracted and used in a variety of ways - descriptors, interfaces, runtime calls ( like in the 3 kinds of mbeans ). But in the end the user of a component decides in what roles he wants to use it and how. > are this typed interfaces expected by the set/add method. The component > being declared of a particular role, may or may not implement the > interface. If it does cool; if not an adaptor will be used to bridge the > gap. It is upto the adaptor to decide if the bean is compatible or not. +1 on this part > The guy writing the container (the thing with the set/add methods) does > not have to deal with introspection or anything of that. As s/he > shouldn't. But by allowing adaptors someone can take some cool object and > bridge it. I think the "container" is ant. Not sure who should write the adapters - IMO ant can support this automatically ( by introspection since we can't use 1.3 features). > So, since now this objects come from somewhere else, if it is not typed > somehow, any object expecting an instance of the role need to do > introspection by hand. Not good. No. It is easy to provide this service in ant - just like it is done in JMX. Code using JMX never does introspection - just calls the "invoke" method. If JDK1.3 is used, he can get a proxy that implements the desired interface. ( I think it can be done for JDK1.2 as well, but a bit harder ). Costin