dev@jsr311.java.net

Re: Container Independence

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 11 Apr 2007 13:45:57 -0400

On Apr 11, 2007, at 7:43 AM, Dhanji R. Prasanna wrote:
>
> > > Agreed. @Resource("someUriTemplate") would be even simpler, with
> > > the option
> > > to specify @Resource(id="someUriTemplate", otherParam="xxx") if
> > > necessary.
> > >
> > Except, syntactically, if you have "otherParam" you *always* have to
> > write @Resource(id="someuri"), you can't use the shortcut @Resource
> > ("someUriTemplate") even if otherParam has a default value.
> > Its not a big deal but worth bearing in mind.
>
> This is incorrect. So long as the first parameter is called "value"
> you can use the shortcut:
> @Resource("blah")
>
> or the long form:
> @Resource(value="blah", other="blah2")
>
> from the same @interface declaration.
> Unfortunately though it *must* be named value.
>
Right but, as you say, you have to name the field "value". Even if
the field is called "value" you also can't write:

@Resource("blah", other="blah2")

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.