[API Review] Property and expression conversion methods
Martin Sladecek
martin.sladecek at oracle.com
Tue Feb 19 12:26:03 PST 2013
As properties extend read only properties, which extend expressions,
using asObject() everywhere would mean we have only one method, which
return covariant return type in subclasses.
Renaming these method will result in 3 method in property classes. E.g.
DoubleProperty would have:
ObjectExpression<Double> asObjectExpression();
ObjectReadOnlyProperty<Double> asReadOnlyObjectProperty();
ObjectProperty<Double> asObjectProperty();
instead of just having
ObjectProperty<Double> asObject();
which overrides ObjectExpression<Double> asObject() from DoubleExpression.
-Martin
On 02/19/2013 06:44 PM, steve.x.northover at oracle.com wrote:
> I agree. asObject seems a bit to general.
>
> Steve
>
> On 19/02/2013 12:23 PM, Richard Bair wrote:
>>> public ObjectExpression<Double> asObject();
>>> public ReadOnlyObjectProperty<Double> asObject();
>>> ObjectProperty<Double> asObject();
>>>
>>> public static<T extends Number> DoubleExpression
>>> doubleExpression(ObservableValue<T>)
>>> public static<T extends Number> ReadOnlyDoubleProperty
>>> readOnlyDoubleProperty(ReadOnlyProperty<T>);
>>> public static<T extends Number> DoubleProperty
>>> doubleProperty(Property<T>);
>> I wonder if we ought not use a consistent naming here, such as
>> asObjectProperty and asDoubleExpression? Also should it be asFoo or
>> toFoo? Is there a precedent?
>>
>> Richard
More information about the openjfx-dev
mailing list