1.约束的继承 constraint-inheritance
Constraint annotations are aggregated if methods are overridden. So if RentalCar
overrode the getManufacturer()
method from Car
, any constraints annotated at the overriding method would be evaluated in addition to the @NotNull
constraint from the superclass.
当方法被子类重写的时候,约束注解将被聚合