Constructor annotation
Eva Krejcirova
eva.krejcirova at oracle.com
Wed Oct 16 04:18:15 PDT 2013
Hi Jack,
On 16.10.2013 13:12, Jack Moxley wrote:
> I would prefer @FXMLConstructor and for the names of the parameters to
> be automagicaly detected and linked, and then an optional
> @FXMLArgument to allow us to specify if the actual name deviates from
> the name of the parameter.
>
> I understand this can be an issue, as parameter names are not
> retained, but we can fetch either from the debugging symbols, or at
> compile time.
This would be nice, but I don't think that it's feasible in FX8 time
frame, unfortunately.
Eva
> ------------------------------------------------------------------------
> *From:* Claus Luethje [mailto:Claus.Luethje at osys.ch]
> *To:* Eva Krejcirova [mailto:eva.krejcirova at oracle.com],
> openjfx-dev at openjdk.java.net [mailto:openjfx-dev at openjdk.java.net]
> *Sent:* Wed, 16 Oct 2013 11:26:12 +0000
> *Subject:* RE: Constructor annotation
>
> Hi
> I'd prefer the second option, because the correlation of the order
> of arguments in the annotation and in the constructors parameters
> is irritating and error prone.
> The way it is structured in option two is seen elsewhere also. So,
> nothing new to learn/absorb.
> @FXMLArgument is a useful name to describe what's going on.
> My 2 cents...
> Regards
> Claus
>
> -----Original Message-----
> From: openjfx-dev-bounces at openjdk.java.net
> <mailto:openjfx-dev-bounces at openjdk.java.net>
> [mailto:openjfx-dev-bounces at openjdk.java.net
> <mailto:openjfx-dev-bounces at openjdk.java.net>] On Behalf Of Eva
> Krejcirova
> Sent: Mittwoch, 16. Oktober 2013 11:22
> To: openjfx-dev at openjdk.java.net <mailto:openjfx-dev at openjdk.java.net>
> Subject: Constructor annotation
>
> Hi All,
>
> when we retired builders, we caused a problem for FXML which
> doesn't have a way to create classes without default constructors.
> Back then we decided to use an annotation for this but never
> actually got to implement it and we need to fix this for FX8. I am
> in the process of adding this functionality to FXMLLoader but we
> need to decide how the annotation will look like and I could use
> some help with this.
>
> We cannot use already existing ConstructorProperties for this,
> because it's java.beans package and we don't want to create to
> dependency on this package in JavaFX, so we need to introduce a
> new annotation.
>
> We have two options:
>
> 1. Annotate the whole constructor:
> e.g.
> @ConstructorArguments({"a", "b", "list"})
> public ImmutableClass(int a, int b, Integer... list)
>
> 2. Annotate the arguments:
> e.g.
> public ImmutableClass(@FXMLArgument("a") int a,
> @FXMLArgument("b")int b, @FXMLArgument("list")Integer... list)
>
>
> Which option do you like more and how should the annotation be named?
>
> Thanks,
> Eva
>
More information about the openjfx-dev
mailing list