> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Leo Simons
> 
> Leo Sutic wrote:
> >         /**
> >          * @@.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).

I just wanted to throw in *some* way of specifying *some* additional 
requirements for the dependency besides the type.

Maybe parameter name + attributes is the way to go. But I prefer not to
encode
much meaning in the parameter name - what if you want a standard
OutputTarget
and a standard (as opposed to secure) SocketManager?

> 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.

Submit it when you want. Sometimes it is better to just get the code 
in than to wait for perfection...

> hmmmmmm.....potentially neat.....how feasible is it to run something 
> like this in a J2EE or servlet container? 

Depends on security settings. I'm not sure, but I think that by default
you can do anything to objects you yourself create. It's only when you
try to do funny stuff of objects you don't "own" that the
SecurityManager
throws a fit.

> 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. 

Since the container does the setting, it can to all validation
neccessary.

> Another concern: how expensive is field reflection in comparison to 
> constructor reflection? I can imagine more than a few 
> differences there...

I don't know. Anyone?

I'm sorry if my answers are just too damn short - gotta run.

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to