RFR: 8301302: Platform preferences API [v5]
Michael Strauß
mstrauss at openjdk.org
Tue Sep 5 23:10:05 UTC 2023
On Tue, 5 Sep 2023 19:26:50 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Removed application preferences implementation
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/application/preferences/PlatformPreferences.java line 112:
>
>> 110: }
>> 111:
>> 112: throw new IllegalArgumentException(
>
> should this behavior be documented?
> there is no mention of an exception in case of type mismatch in the base class.
>
> also, do we want to have some kind of trivial conversion implemented such as int -> long -> double ?
> or not?
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?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1316502374
More information about the openjfx-dev
mailing list