age min: new Date()
price min: 0F
min
目的
確保值不會低於最小值。
範例
說明
設定實作 java.lang.Comparable
的類別的最小值。值的類型必須與屬性相同。
請注意,約束只會評估一次,這可能與依賴於值的約束相關,例如 java.util.Date
的實例。
class User {
...
static constraints = {
// this Date object is created when the constraints are evaluated, not
// each time an instance of the User class is validated.
age min: new Date()
}
}
此約束會影響 Schema 產生。
錯誤代碼:className.propertyName.min.notmet