What is the difference between get() and GetValue() in DoublePropertyBase?


Question

I had this listing and i can't see what is the porpouse:

DoubleProperty value = new DoublePropertyBase(0) {
        @Override protected void invalidated() {
            if (getValue() < get()) setValue(get());
        }
        @Override public String getName() { return "value"; }
    };

Is like getValue() is the new Value and get() is the old, but the documentation does not say that.

1
5
6/4/2014 4:21:08 PM

Accepted Answer

If you look at the Sourcecode of the superclasse of DoubleProperty you can see that booth methodes return the same value. Get as primitive type double and getValue the object Double

javafx.beans.binding.DoubleExpression

@Override
public Double getValue() {
return get();
}

javafx.beans.property.ReadOnlyDoubleProperty

@Override
public double get() {
valid = true;
final T value = property.getValue();
return value == null ? 0.0 : value.doubleValue();
7
6/4/2014 4:38:30 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon