API review: Conversion methods in Binding API

Richard Bair richard.bair at oracle.com
Fri Nov 2 13:54:12 PDT 2012


I haven't seen this as a request by developers yet, I tend to think we ought to keep this feature / tweak in our backlog and revisit if / when we see some demand from users?

Richard

On Sep 18, 2012, at 12:00 AM, Michael Heinrichs <michael.heinrichs at oracle.com> wrote:

> Hi,
> 
> there are sometimes situations, when a developer has a general typed value, but needs a specific type, e.g. a user may have an ObjectProperty<Integer> but needs an ObservableIntegerValue. I want to add some conversion methods for these kind of cases. http://javafx-jira.kenai.com/browse/RT-19020
> 
> class BooleanExpression:
> public static BooleanExpression booleanExpression(ObservableValue<Boolean>)
> The current booleanExpression() method will be marked as deprecated and should be removed when we do an incompatible update of the JavaFX API. Same for the methods in DoubleExpression etc.
> 
> class DoubleExpression:
> public static <T extends Number> DoubleExpression doubleExpression(ObservableValue<T>)
> 
> class FloatExpression:
> public static <T extends Number> FloatExpression floatExpression(ObservableValue<T>)
> 
> class IntegerExpression:
> public static <T extends Number> IntegerExpression integerExpression(ObservableValue<T>)
> 
> class LongExpression:
> public static <T extends Number> LongExpression longExpression(ObservableValue<T>)
> 
> class ObjectExpression:
> public BooleanBinding asBoolean()
> public DoubleBinding asDouble()
> public FloatBinding asFloat()
> public IntegerBinding asInteger()
> public LongBinding asLong()
> The bindings returned by these methods will return the default value, if the type of the wrapped Object does not match the expected.
> 
> class Bindings:
> public static BooleanExpression convertToBoolean(ObservableValue<Boolean>)
> public static <T extends Number> DoubleExpression convertToDouble(ObservableValue<T>)
> public static <T extends Number> FloatExpression convertToFloat(ObservableValue<T>)
> public static <T extends Number> IntegerExpression convertToInteger(ObservableValue<T>)
> public static <T extends Number> LongExpression convertToLong(ObservableValue<T>)
> 
> Thanks,
> Michael



More information about the openjfx-dev mailing list