[API Review] Property and expression conversion methods
    Martin Sladecek 
    martin.sladecek at oracle.com
       
    Thu Feb 21 02:12:50 PST 2013
    
    
  
On 19.2.2013 18:23, 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
DoubleExpression already has one doubleExpression() static method for a 
bit different conversion (from ObservableDoubleValue), so it's 
consistent with this method.
About the precedent, I did a little search and we have:
*Expression.asString()
and (aside of toString() overrides)
Duration.toMillis() (and other time units)
My gut feeling here is that we should use "as" for wrappers that are 
referencing the original object somehow, some kind of views of the 
original object and "to" for new (constant) values that don't have any 
reference to the original object and don't change when the original 
object changes.
-Martin
    
    
More information about the openjfx-dev
mailing list