[API Review] Property and expression conversion methods

steve.x.northover at oracle.com steve.x.northover at oracle.com
Tue Feb 19 14:30:58 PST 2013

I understand.  Since they are all a kind of expression, perhaps 
asObjectExpression() is the name we should use.

Another possibility is to create a new instance of the adapter class 
explicitly (ie. new ReadOnlyObjectProperyAdapter(zzzz)) rather than 
zzzzx.asXXX()) method.  Not sure if this is better or worse.


On 19/02/2013 3:26 PM, Martin Sladecek wrote:
> 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