While studying BeanValidation from documented here, I came to know that @Digits
supports String
datatype. here the snap-shot from documentation.
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
*/
How can Digits behave for String type? On what base @Digit
will validate to String
type? Will it behave like digit regex validation (@Pattern)?