title: Bean Validation: Does @Digits validator support Double?
body: <p>In the Bean Validation spec ( both version <a href="http://beanvalidation.org/1.0/spec/" rel="nofollow">JSR 303</a> and <a href="http://beanvalidation.org/1.1/spec/" rel="nofollow">JSR 349</a> ) and <a href="http://docs.jboss.org/hibernate/beanvalidation/spec/1.1/api/" rel="nofollow">docs</a>, both don't mention anything about @Digits support for Double or Float types. It only says it supports the following types:</p>
  
  <ul>
  <li>BigDecimal</li>
  <li>BigInteger</li>
  <li>CharSequence</li>
  <li>byte, short, int, long, and their respective wrapper types</li>
  </ul>
  
  <p>However, I tested it many times against Double fields in  my entities and I found that it works well!</p>
  
  <p>Does it have any drawbacks that I can not see? Is it discouraged to use it with Double?</p>
  
  <p>Also I found the documentation does explicitly say that <a href="http://docs.jboss.org/hibernate/beanvalidation/spec/1.0/api/javax/validation/constraints/Min.html" rel="nofollow">@Min</a> and <a href="http://docs.jboss.org/hibernate/beanvalidation/spec/1.0/api/javax/validation/constraints/Max.html" rel="nofollow">@Max</a> don't support Double and Float. However, It is not that clear about the <a href="http://docs.jboss.org/hibernate/beanvalidation/spec/1.0/api/javax/validation/constraints/Digits.html" rel="nofollow">@Digits</a></p>