dev@jsr311.java.net

RE: Alternate API proposition

From: Jerome Louvel <jerome.louvel_at_noelios.com>
Date: Wed, 25 Apr 2007 14:42:12 +0200

Hi Paul,

Good point. If used on local variables, it would indeed require some source
pre-processing. In addition, the annotation would also be usable on fields
or a method parameters, just like the common @Resource annotation:
http://java.sun.com/javaee/5/docs/api/javax/annotation/Resource.html

Best regards,
Jerome

> -----Message d'origine-----
> De : Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Envoyé : mercredi 25 avril 2007 13:17
> À : dev_at_jsr311.dev.java.net
> Objet : Re: Alternate API proposition
>
> Hi Jerome,
>
> Many thanks for sending this. I have not looked in sufficient
> detail yet
> to make enough informed comments but do i have one
> observation and one
> technical question that occurred to me when browsing the source code.
>
>
> The observation is that i think there is some notational
> agreements on
> some things (at least in partial scope) even if the names are
> different.
>
>
> The question is how do you propose to inject something at
> runtime on to
> a local variable? or example:
>
> public AccountResource() {
> @Variable("blinksale_id")
> String blinksaleId = null;
>
> this.account = Accounts.getInstance(blinksaleId);
> }
>
> or did you mean for the 'blinksaleId' local variable to be a method
> parameter instead?
>
> Annotations on local variables are not retained at runtime [1]:
>
> "An annotation on a local variable declaration is never retained in
> the binary representation."
>
> and it is not possible to get access to such annotations at runtime
> using Java reflection.
>
> Paul.
>
> [1]
> http://java.sun.com/docs/books/jls/third_edition/html/interfac
> es.html#9.6.1.2
>
> Jerome Louvel wrote:
> > Hi all,
> >
> > As promised, I've worked on a sample application (based on
> BlinkSale API)
> > that illustrates some of the ideas I have in mind for this JSR API.
> >
> > The Javadocs and source code should be self explaining, but
> I can detail
> > more if needed.
> >
> > The idea is to provide a sketch that can illustrates my
> point of view and
> > triggers some discussions. It doesn't pretend to be a
> complete solution, but
> > it does seem to provide the main pieces to implement an API such as
> > BlinkSale. Note that I haven't fully covered the BlinkSale
> resources yet,
> > but the design pattern should be obvious.
> >
> > Best regards,
> > Jerome
> >
> >
> >
> --------------------------------------------------------------
> ----------
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> > For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>
> --
> | ? + ? = To question
> ----------------\
> Paul Sandoz
> x38109
> +33-4-76188109
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>