Extending builders

Milan Kubec milan.kubec at oracle.com
Fri Nov 30 01:56:34 PST 2012


Hello,
I'm slightly more for the second option: having "BuilderProperty"
annotation for curent methods, because then builder authors are free do
do anything they want without worying about breaking SB and FXML
introspection functionality and creating new annotation to distinguish
some new methods of functionality.

BuilderProperty annotation can have parameters to fine tune property
handling via introspection.

  Milan


Dne 28.11.2012 16:27, Eva Krejcirova napsal(a):
> There will certainly be methods with one argument, so this means that
> there must be a way for SceneBuilder and FXML to tell these methods
> apart from the property methods.
> We can annotate the convenience methods by special annotation (e.g.
> BuilderConvenienceMethod).
> Or we could add an annotation (e.g. BuilderProperty) to the methods
> which correspond to properties (= the methods which are currently in
> the builders).
>
> Eva
>
> On 22.11.2012 16:01, Daniel Fuchs wrote:
>> On 11/22/12 3:40 PM, Eva Krejcirova wrote:
>>> Hi,
>>>
>>> There is one more thing which needs to be sorted out before adding new
>>> methods to builders:
>>> SceneBuilder and FXML use builders to find names of properties of a
>>> class, so they need to have a way to differentiate between the new
>>> convenience methods and the methods which correspond to properties of a
>>> class. Daniel, is this still true?
>>>
>>> Last time we discussed this, Daniel suggested to annotate these new
>>> convenience methods. If we go this way, we need to create a new runtime
>>> annotation (and find a name for it :-) )
>>>
>>> Eva
>>
>> Hi Eva,
>>
>> Yes this is still true. Note that SceneBuilder actually uses
>> builders only in special cases - for WebView - for instance -
>> because of the fake location attribute available on WebViewBuilder
>> only - and for any type which has no public constructors (e.g.: all
>> charts, Insets, etc...)
>>
>> However - SceneBuilder discovers whether there are constructor
>> properties by introspecting ClassX and ClassXBuilder and comparing
>> the results: it takes the name of all the single parameter
>> instance methods in ClassXBuilder which returns a builder,
>> remove the names of all writable (getter+setter) properties
>> found in ClassX, and what remain are assumed to be constructor
>> properties.
>>
>> As long as the convenience methods have more than 1 parameter
>> (varargs count for 1)  then this logic should remain valid.
>>
>> The FXMLLoader's JavaFXBuilderFactory also introspects builders
>> in order to find out writable properties and type of properties,
>> so that's another place you will have to look at
>> (class JavaFXBuilderFactory.JavaFXBuilder).
>>
>> best regards,
>>
>> -- daniel
>>
>>
>>
>



More information about the openjfx-dev mailing list