> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Leo Simons
>
> interface TransientFactory
> {
> public Object get();
> public void put( Object o );
> Class provides(); // at least a little bit of "hard-coded"
> // client-side validation
> }
+0.1 I ***hate*** client-side validation of container contracts.
>
> interface TransientFactory
> {
> public Object get();
> public Object get( Class expectedClass )
> throws CannotProvideExpectedClassException;
> // Spring framework has this one
> public void put( Object o );
> }
+0.5 I ***hate*** client-side validation of container contracts, but
at least it is optional here.
> Then there's the option of seperating out the validation into
> helpers or
> wrappers or aspects or metadata with the hope of saving some lines of
> typing at the cost of increased complexity.
Or you could ram it into the container. (Probably the best option.)
> There's even weirder alternatives like
> per-component-thread-with-threadlocal.
That can be hidden behind a proxy. (I.e. made to appear like a stateless
singleton.)
> > /**
> > * @@.saxTransformerFactory Dependency (SAXTransformer.class)
> > */
> > public MyClient (TransientFactory saxTransformerFactory) {
> > this.saxTransformerFactory = saxTransformerFactory;
> > }
>
> did you ever get the metadata for an argument-by-name association
> working properly?
What? Like the example above? Sure.
I even have a:
/**
* @@.return MyAttribute ()
*/
public Object myMethod () {
...
}
to add metadata to return attributes.
Or do you mean a function like:
String getArgumentName (Method method, int argumentIndex);
?
No, I didn't. That would require me to generate data for every Java
source file, not just those that used attributes.
(In terms of magic, the org.apache.commons.attributes package is
the equivalent of an industrial-grade high-pressure mana fountain. There
is nothing that can't be obfuscated. That said, you can do pretty neat
stuff with it.)
> > This is one for A5 definitely
>
> why? It's not backwards-incompatible :D
It is, since a lookup() of a pooled component will give you a
factory instead of the component itself.
/LS
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]