richard.bair at oracle.com
Thu Nov 29 14:28:25 PST 2012
I'm confused, don't we want scene builder / FXML to be able to use these new methods defined on builders as well? If they are used, then we have to use a builder instead of just configuring an object via reflection, or some such?
On Nov 28, 2012, at 7:27 AM, Eva Krejcirova <eva.krejcirova at oracle.com> wrote:
> 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).
> On 22.11.2012 16:01, Daniel Fuchs wrote:
>> On 11/22/12 3:40 PM, Eva Krejcirova wrote:
>>> 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 :-) )
>> 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