|
68 | 68 | import javax.validation.constraints.DecimalMin; |
69 | 69 | import javax.validation.constraints.Max; |
70 | 70 | import javax.validation.constraints.Min; |
| 71 | +import javax.validation.constraints.Negative; |
| 72 | +import javax.validation.constraints.NegativeOrZero; |
71 | 73 | import javax.validation.constraints.NotBlank; |
72 | 74 | import javax.validation.constraints.NotEmpty; |
73 | 75 | import javax.validation.constraints.NotNull; |
74 | 76 | import javax.validation.constraints.Pattern; |
| 77 | +import javax.validation.constraints.Positive; |
| 78 | +import javax.validation.constraints.PositiveOrZero; |
75 | 79 | import javax.validation.constraints.Size; |
76 | 80 | import javax.xml.bind.annotation.XmlAccessType; |
77 | 81 | import javax.xml.bind.annotation.XmlAccessorType; |
@@ -1898,6 +1902,34 @@ protected boolean applyBeanValidatorAnnotations(Schema property, Annotation[] an |
1898 | 1902 | modified = ValidationAnnotationsUtils.applyEmailConstraint(property, email) || modified; |
1899 | 1903 | } |
1900 | 1904 | } |
| 1905 | + if (annos.containsKey(JAVAX_POSITIVE)) { |
| 1906 | + Positive positive = (Positive) annos.get(JAVAX_POSITIVE); |
| 1907 | + boolean apply = checkGroupValidation(positive.groups(), invocationGroups, acceptNoGroups); |
| 1908 | + if (apply) { |
| 1909 | + modified = ValidationAnnotationsUtils.applyPositiveConstraint(property) || modified; |
| 1910 | + } |
| 1911 | + } |
| 1912 | + if (annos.containsKey(JAVAX_POSITIVE_OR_ZERO)) { |
| 1913 | + PositiveOrZero positiveOrZero = (PositiveOrZero) annos.get(JAVAX_POSITIVE_OR_ZERO); |
| 1914 | + boolean apply = checkGroupValidation(positiveOrZero.groups(), invocationGroups, acceptNoGroups); |
| 1915 | + if (apply) { |
| 1916 | + modified = ValidationAnnotationsUtils.applyPositiveOrZeroConstraint(property) || modified; |
| 1917 | + } |
| 1918 | + } |
| 1919 | + if (annos.containsKey(JAVAX_NEGATIVE)) { |
| 1920 | + Negative negative = (Negative) annos.get(JAVAX_NEGATIVE); |
| 1921 | + boolean apply = checkGroupValidation(negative.groups(), invocationGroups, acceptNoGroups); |
| 1922 | + if (apply) { |
| 1923 | + modified = ValidationAnnotationsUtils.applyNegativeConstraint(property) || modified; |
| 1924 | + } |
| 1925 | + } |
| 1926 | + if (annos.containsKey(JAVAX_NEGATIVE_OR_ZERO)) { |
| 1927 | + NegativeOrZero negativeOrZero = (NegativeOrZero) annos.get(JAVAX_NEGATIVE_OR_ZERO); |
| 1928 | + boolean apply = checkGroupValidation(negativeOrZero.groups(), invocationGroups, acceptNoGroups); |
| 1929 | + if (apply) { |
| 1930 | + modified = ValidationAnnotationsUtils.applyNegativeOrZeroConstraint(property) || modified; |
| 1931 | + } |
| 1932 | + } |
1901 | 1933 | if (validatorProcessor != null && validatorProcessor.getMode().equals(ValidatorProcessor.MODE.AFTER)) { |
1902 | 1934 | modified = validatorProcessor.applyBeanValidatorAnnotations(property, annotations, parent, applyNotNullAnnotations) || modified; |
1903 | 1935 | } |
@@ -1961,6 +1993,18 @@ protected boolean applyBeanValidatorAnnotationsNoGroups(Schema property, Annotat |
1961 | 1993 | Email pattern = (Email) annos.get(JAVAX_EMAIL); |
1962 | 1994 | modified = ValidationAnnotationsUtils.applyEmailConstraint(property, pattern) || modified; |
1963 | 1995 | } |
| 1996 | + if (annos.containsKey(JAVAX_POSITIVE)) { |
| 1997 | + modified = ValidationAnnotationsUtils.applyPositiveConstraint(property) || modified; |
| 1998 | + } |
| 1999 | + if (annos.containsKey(JAVAX_POSITIVE_OR_ZERO)) { |
| 2000 | + modified = ValidationAnnotationsUtils.applyPositiveOrZeroConstraint(property) || modified; |
| 2001 | + } |
| 2002 | + if (annos.containsKey(JAVAX_NEGATIVE)) { |
| 2003 | + modified = ValidationAnnotationsUtils.applyNegativeConstraint(property) || modified; |
| 2004 | + } |
| 2005 | + if (annos.containsKey(JAVAX_NEGATIVE_OR_ZERO)) { |
| 2006 | + modified = ValidationAnnotationsUtils.applyNegativeOrZeroConstraint(property) || modified; |
| 2007 | + } |
1964 | 2008 | return modified; |
1965 | 2009 | } |
1966 | 2010 |
|
|
0 commit comments