score:0

Accepted answer

Since there are not unsigned ints in scala or java, all you can do is write a runtime check. Something like this should do it: (haven't tested it)

object budget extends MappedInt(this) {
  override def validations = {
    ((value:Int) =>
      if (value < 0)
        FieldError(fieldOwner, Text("Budget must not be negative"))::Nil
      else
        Nil)
    :: super.validations
  }
}

Related Query

More Query from same tag