我有以下内容:
class Img {
static constraints = {
imageSize(nullable: true, maxSize: 1000)
}
}
我想将imageSize变量的maxSize更改为我的程序中的其他内容,我试过这个但是它不起作用:
def img = new Img()
images.imageSize.maxSize = 800
编辑:
class Img {
byte[] imageSize
static constraints = {
imageSize(nullable: false, maxSize: 1000)
}
}
答案 0 :(得分:0)
试试这样:
ConstrainedProperty constrainedProperty = Img.constraints.imageSize
constrainedProperty.setMaxSize(800)