TornadoFX has an select
function that is used to access a property within a property. For example, the usage would be:
textfield(viewModel.customerProperty.select(Customer::nameProperty))
And that works fine, however, in case that the customerProperty
's value is nullable ( Customer?
), select
doesn't work, because it expects non-null object to "select" from.
In case that the Property
has nullable
value, how can select
be used on it?
You don't need to declare the type as nullable even though the property can contain null. Simply change the type of the property and you should be good.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.