2017-07-26 5 views
2

2.5から2.6にアップグレードされたプレイフレームワークの後に次のエラーが発生しました。 は Scalaのバージョン(2.5でコンパイルすることができました):2.11.8Play2.6のフォームを使用しない制約の検証

ambiguous reference to overloaded definition, 
[error] both method emailAddress in trait Constraints of type => play.api.data.validation.Constraint[String] 
[error] and method emailAddress in trait Constraints of type (errorMessage: String)play.api.data.validation.Constraint[String] 
[error] match argument types (String) 
[error] Constraints.emailAddress("[email protected]") 
        ^

プレイ2.6と制約の下でメソッドを使用する方法はありますか?あなたのようにそれをテストすることができますので、あなたがコンパイルエラーを与えるパラメータでEMAILADDRESSを呼び出すので、もし:(文字列=「error.email」にErrorMessage)メソッドを

import play.api.data.validation._ 

val result = Constraints.emailAddress("[email protected]") 

答えて

0

EMAILADDRESSは内部で別のオーバーライドされたメソッドEMAILADDRESS呼び出すメソッドですこの

val result = Constraints.emailAddress 

    result("[email protected]") 
関連する問題