[API Review] Property and expression conversion methods

steve.x.northover at oracle.com steve.x.northover at oracle.com
Thu Feb 21 08:01:05 PST 2013


Ok, consistency with asString() seems good to me.

Steve

On 21/02/2013 6:20 AM, Martin Sladecek wrote:
> As expressions already have asString() that returns StringBinding, I 
> think it's better to call it asObject(), but I don't strongly insist 
> on this name, asObjectExpression() is a good option too.
>
> -martin
>
> On 19.2.2013 23:30, steve.x.northover at oracle.com wrote:
>> 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.
>>
>> Steve
>>
>> 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