Mik*_*key 0 validation grails integer digits grails-orm
有没有比验证器更好的方法来强制执行整数,例如2位数?
在我的幻想世界中,我会做这样的事情:
class FantasyDomainClass{
Integer[2] twoDigitInteger //fantasy world knows I mean base 10
}
Run Code Online (Sandbox Code Playgroud)
也许BigInteger?
基于提出的答案,我在考虑我可能不需要整数,因为'01'是可接受的值.
您可以在字段上设置10到99之间的约束:
class FantasyDomainClass {
Integer twoDigitInteger
static constraints = {
twoDigitInteger min:10, max:99
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2837 次 |
| 最近记录: |