The Validate Methods
In unions of modddels, the validate methods also benefit from the shared properties feature and the case-modddels pattern matching.
Continuing with our Weather
example (you can find it here), here is an example of an implementation of the validateHabitable
method.
In this implementation, the 'habitable' validation will fail under the following conditions :
No matter the weather kind (
Sunny
orRainy
) : If thetemperature
is more than 60 or less than -10, the validation failsFor the
Rainy
weather : If therainIntensity
is more than 2.5, the validation fails.
Last updated