On Tue, 5 Sep 2023 23:27:44 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> It is documented in the `Platform.Preferences` interface, which is 
>> implemented by this class:
>> 
>> 
>>         /**
>>          * Returns the value to which the specified key is mapped.
>>          *
>>          * @param <T> the type of the value
>>          * @param key the key
>>          * @param type the type of the value
>>          * @throws NullPointerException if {@code key} is null
>>          * @throws IllegalArgumentException if the key is not mapped to a 
>> {@code type} instance
>>          * @return the value to which the key is mapped, or {@code 
>> Optional.empty()}
>>          *         if no mapping exists for the specified key
>>          */
>>         <T> Optional<T> getValue(String key, Class<T> type);
>> 
>> 
>> I'm a bit hesitant regarding an automatic conversion. What would be the use 
>> case for this?
>
> one [possible] use case is when different versions of the native platform 
> have different types (int32/int64 ?).
> or, if the property value is String with the semantics of an integer.
> 
> Of course, the app dev can always request an Object and parse that.

If we add this, we'd also need to decide whether we only want to support 
lossless conversions, or if lossy conversions are acceptable as well. Since 
this will add a considerable amount of complexity to this PR, I suggest we 
don't to it at this time. If there's a need, we can always add it later.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1316537786

Reply via email to