문서화 된 here에서 BeanValidation을 연구하면서 @Digits
이 String
데이터 유형을 지원한다는 것을 알게되었습니다. 여기 문서에서 스냅 샷.@Digits 제약 (Bean Validation-JSR 303)이 String 유형을 지원하는 방법은 무엇입니까?
package javax.validation.constraints;
/**
* The annotated element must be a number within accepted range
* Supported types are:
* <ul>
* <li><code>BigDecimal</code></li>
* <li><code>BigInteger</code></li>
* <li><code>String</code></li>
* <li><code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>,
* and their respective wrapper types</li>
* </ul>
* <p/>
* <code>null</code> elements are considered valid
*
* @author Emmanuel Bernard
*/
숫자가 문자열 유형에 대해 어떻게 작용할 수 있습니까? 어떤 기초에 String
유형을 유효하게 할 것입니까? 숫자 정규 표현식 검증 (@Pattern)과 같이 동작합니까?