/**
* @@.std RequireDependencyAttribute ( "standard" )
* @@.err RequireDependencyAttribute ( "error" )
*/
public MyComponent( OutputTarget std, OutputTarget err ) { ... }
I still really like:
public MyComponent( OutputTarget standard, OutputTarget error ) { ... }
(note: lack of attributes) allowing you to do away with the specification of the attributes at all here (the information you need is already there: its the parameter name). Hacked that together based on commons-sandbox-attributes (those dumb java .class files don't record the parameter name), but currently too ugly to submit a patch.
Still, IMVHO it is the future of COP! (until I find myself a new pet idea, which I'm trying to do every week)
Random question - are attributes inherited here?
I'd say not. Constructors aren't inherited either.
---
public class MyComponent {
/** * @@Dependency * @@RequireDependencyAttribute ( "standard" ) */ private OutputTarget standard;
hmmmmmm.....potentially neat.....how feasible is it to run something like this in a J2EE or servlet container? And on second thought, this doesn't allow you to do any kind of validity checking in the component. Any kind of exception (likely, NPE) resulting from a composition error is not thrown during composition but on a method call. I think. Using aspectwerkz or somethin' one could advise the field access though.......
oh, and (same point again)
/** @@Dependency */
private OutputTarget standard;is just a /little/ more neat I think. When we get the meta JSR stuff in place (like, in 4 years, when JDK1.5 is a realistic deployment target):
private transient [Dependency] OutputTarget standard;
could become a reality.
A container can now get attributes for all fields (even the private ones) and set the dependencies just after invoking the constructor.
Another concern: how expensive is field reflection in comparison to constructor reflection? I can imagine more than a few differences there...
g'night!
- Leo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
