On Thu, 21 Nov 2024 20:15:00 GMT, Andy Goryachev <[email protected]> wrote:
>> modules/jfx.incubator.input/src/main/java/jfx/incubator/scene/control/input/FunctionTag.java
>> line 51:
>>
>>> 49: public final class FunctionTag {
>>> 50: /** Constructs the function tag. */
>>> 51: public FunctionTag() {
>>
>> Should this be more than a simple "marker" Object with identity, but no
>> state? There is no way to get the information from a particular function tag
>> instance as to what it represents, nor is there a useful "toString()"
>> method. There is also no way to get the set of available FunctionTag objects
>> from the nested <Control>.Tag class. Perhaps we could be informed by the
>> Enum class?
>>
>> If there was value in doing this, maybe it could be a record?
>>
>>
>> public final record FunctionTag(String name) { }
>>
>>
>> This would be mostly useful for tooling, since most applications aren't
>> likely to need it.
>>
>> It might be worth noting, even if you prefer not to make this change.
>
> The main reason there is no name field in the FunctionTag is to simplify the
> life of custom components or internal skin developers. There is just not
> enough value, in my opinion.
>
> The argument about tooling is an interesting one. At first glance, I think
> it is possible to retrieve both function tag name and the list of tags
> declared by the control using trivial reflection.
>
> The other possibility is to forgo FunctionTag completely and just use naked
> Strings, losing some degree of type clarity.
I don't like the idea of using a raw String at all. Let's leave it as is for
now and see if we get any requests to add a name.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1524#discussion_r1861351121