Constructor annotation

Eva Krejcirova eva.krejcirova at oracle.com
Wed Oct 16 06:49:43 PDT 2013


On 16.10.2013 11:26, Tom Eugelink wrote:
>
> Would the duality of using the parameter info when available or else 
> the annotation (2nd option) be an viable approach?
This is probably doable but I am not sure whether we want to turn on the 
parameter info for the whole JavaFX - last time I checked it was not 
possible to specify that we need it only for constructors, so the class 
files then contain names of arguments of all methods even if we don't 
need them.

Eva

>
> Tom
>
>
> On 2013-10-16 11:22, Eva Krejcirova wrote:
>> 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