且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何为play2的表单定义StopOnFirstFail dsl?

更新时间:2023-01-17 22:29:41

or方法不使用类型参数:

The or method does not take a type parameter:

implicit def toLazyOr[T](cons: Constraint[T]) = new {
  def or(other: Constraint[T]) = Constraint { field: T =>
    cons(field) match {
      case Valid => other(field)
      case Invalid => Invalid
    }
  }
}