[REVIEW REQUEST] Pre-built StringConverter Implementations
Jonathan Giles
jonathan.giles at oracle.com
Tue Dec 20 21:37:07 PST 2011
With the introduction of the ComboBox control (and discussion around
editable Spinner and future controls like the Calendar Picker) we are
more formally working towards consistently using the StringConverter in
various places in the controls API, and usages of this class will only
become more prevalent over time.
One of the goals for JavaFX after shipping JavaFX 2.0 was to fill in the
gaps in the API. One gap that is now more important than ever is to
provide a number of pre-built StringConverters, and this is what I'm
keen to have reviewed today. As part of introducing the ComboBox
control, I'm wanting to make available a number of these
implementations. You can find all source code to these implementations
in the Jira issue for the ComboBox control [1].
All implementations are forked from JSR-273: Design-Time API for
JavaBeans (JBDT), in particular, the code from the package
javax.beans.convert [2]. This is the same JSR that Rich recently forked
for design time APIs that appeared in the repo. There have been some
changes in the forked code:
* All classes have been renamed from <type>PropertyConverter to
<type>StringConverter.
* All classes extend javafx.util.StringConverter rather than
PropertyConverter.
* StringConverter, having a generic type, allows for the method
signatures to be more type-specific, which we now take advantage of.
At a higher level, this API will be a new javafx-ui-converter project
inside the open source 'rt' folder. With regard to unit tests, it is my
intention to write unit tests to cover all use cases, to ensure validity
and consistency. Presently I have 150 unit tests that cover 84% of lines
and 74% of branches, and this will increase as time permits.
I do have some questions:
* Can people foresee any issues with the more tightly-constrained
generics? I can't imagine there being an issue, but let me know...
* What used to be called StringPropertyConverter is now called
DefaultStringConverter, which is a kind of a shame (with 'Default' being
a bit of a misnomer). Sure, to be accurate I'd call it
StringStringConverter, but that ain't any better... :-)
Any feedback would be much appreciated.
[1] http://javafx-jira.kenai.com/browse/RT-17956
[2]
http://www.koders.com/info.aspx?c=ProjectInfo&pid=BRCKM22353APEAQBQ3MY5WMRCA
Thanks,
-- Jonathan
More information about the openjfx-dev
mailing list