org.reactfx.value.MappedVal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
FX-Text-Area for formatted text and other special effects.
package org.reactfx.value;
import java.util.function.Function;
import javafx.beans.value.ObservableValue;
import org.reactfx.Subscription;
class MappedVal extends ValBase {
private final ObservableValue src;
private final Function super T, ? extends U> f;
MappedVal(
ObservableValue src,
Function super T, ? extends U> f) {
this.src = src;
this.f = f;
}
@Override
protected U computeValue() {
T baseVal = src.getValue();
return baseVal != null ? f.apply(baseVal) : null;
}
@Override
protected Subscription connect() {
return Val.observeInvalidations(src, obs -> invalidate());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy