一、@GroupSequence
除了定义组队列以外,这个@GroupSequence注解也允许重新定义默认的组,对于一个给定的类。为了这么做,仅仅只需要在类上加上@GroupSequence注解,指定组的队列,它就可以为该类替换默认值的组的队列。
下面的例子展示一个重新定义默认的组队列:
@GroupSequence({
RentalChecks.class, CarChecks.class, RentalCar.class })
public class RentalCar extends Car {
@AssertFalse(message = "The car is currently rented out", groups = RentalChecks.class)
private boolean rented;
public RentalCar(String manufacturer, String licencePlate, int seatCount) {
super( manufacturer, licencePlate, seatCount );
}
public boolean isRented() {
return rented;