I have a BooleanBinding in JavaFX whose logic is like:
if certificationType is not equal to noCertificationType
then
return true
else if (certificationType is equal to recordsVerificationCertificationType or landHoldingsCertificationType) and applicationPropertyObservableList is not empty
then
return true
else
return false
end if
I wrote a method to express such validation as follows:
private BooleanBinding certificationTypeBooleanBinding() {
return Bindings.createBooleanBinding(() ->
!this.certificationType.getValue().equals(Applications.noCertificationType()) || (
(this.certificationType.getValue().equals(Applications.recordsVerificationCertificationType()) ||
this.certificationType.getValue().equals(Applications.landHoldingsCertificationType())
) && !this.applicationPropertyObservableList.getValue().isEmpty()
), this.certificationType, this.applicationPropertyObservableList);
}
Only !this.certificationType.getValue().equals(Applications.noCertificationType())
works. The or (|| ()
) part does not.
How do I make it work? Thank you.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…