grails-浮动的最小/最大约束失败?
我有这门课:grails-浮动的最小/最大约束失败?,grails,constraints,gorm,Grails,Constraints,Gorm,我有这门课: class SomeClass { float percent static constraints = { percent(min:1.0F, max:100.0F) } } 当我启动应用程序时,会出现以下错误: Parameter for constraint [min] of property [percent] of class [class SomeClass] must be the same type as propert
class SomeClass {
float percent
static constraints = {
percent(min:1.0F, max:100.0F)
}
}
当我启动应用程序时,会出现以下错误:
Parameter for constraint [min] of property [percent] of class [class SomeClass] must be the same type as property: [float]
这是一个bug还是我做错了什么?我认为你应该使用small
f
而不是f
:
static constraints = {
percent(min:1.0f, max:100.0f)
}
或
尝试将
百分比
的类型更改为浮动
,那么1.0F应该是有效的这是我第一次尝试的。结果是一样的。我在文档中发现了一个带有大号字母F的示例-这就是我这样写的原因尝试将percent
的类型更改为Float
,然后1.0F
应该是有效的