io.github.srs.model.validation.Validation$package.Validation
Companion object for Validation that provides utility methods for common validations.
Attributes
-
Graph
-
-
Supertypes
-
class Object
trait Matchable
class Any
-
Self type
-
Members list
Ensures the given numeric value is strictly positive.
Ensures the given numeric value is strictly positive.
Type parameters
-
T
-
any Numeric type (e.g., Int
, Double
, etc.)
Value parameters
-
field
-
name of the validated field (for error reporting)
-
v
-
numeric value to check
Attributes
-
Returns
-
Right with the value if it is positive, otherwise Left with a DomainError.NegativeOrZero error.
-
Example
-
import io.github.srs.model.validation.Validation.*
positive("width", 10) // Right(10)
positive("width", 0) // Left(NegativeOrZero("width", 0.0))