“热到”;“展平”;TornadFX(JavaFX扩展)中ObjectProperty的ObjectProperty?
假设我有三门课:“热到”;“展平”;TornadFX(JavaFX扩展)中ObjectProperty的ObjectProperty?,java,javafx,kotlin,tornadofx,Java,Javafx,Kotlin,Tornadofx,假设我有三门课: class A { val bProperty: ObjectProperty<B> = SimpleObjectProperty(B(C("test"))) val cObservable: ObservableValue<C> = ??? } class B(initialC: C) { val cProperty: ObjectProperty<C> = SimpleObjectProperty(initia
class A {
val bProperty: ObjectProperty<B> = SimpleObjectProperty(B(C("test")))
val cObservable: ObservableValue<C> = ???
}
class B(initialC: C) {
val cProperty: ObjectProperty<C> = SimpleObjectProperty(initialC)
}
class C(val string: String)
但这给了我一个ObservableValue
的ObservableValue
的C
的ObservableValue
。所以这不是我能处理的
提前感谢您的帮助。您可以使用
选择
扩展方法:
val cObservable: ObservableValue<C> = bProperty.select { it.cProperty }
val cObservable:observeValue=bProperty.select{it.cProperty}
或:
val cObservable:observeValue=bProperty.select(B::cProperty)
val cObservable: ObservableValue<C> = bProperty.select { it.cProperty }
val cObservable: ObservableValue<C> = bProperty.select (B::cProperty)