title: Fasterxml Jackson automatically converts non-boolean value to a boolean value
body: <p>I have a pojo class where one of the flag <code>isControl</code> which is of type Boolean. </p>
  
  <p>When this property gets a non boolean value other than <code>true or false</code> fasterxml jackson automatically converts the input value to <code>true</code>. After debugging for few hours I find out that this is happening in the setter method <code>setIsControl</code>.</p>
  
  <p>I want to pass a custom message if input value for this property is non-boolean. I have written my own annotation to validate the input value for this property and return custom message if its not a boolean value but jackson binds the value  before checking my custom validator. </p>
  
  <p>Using jackson version >>> <code>2.6.3</code>. Any help will be appreciated.</p>
  
  <p>Control.java</p>
  
  <pre><code>    @JsonProperty(required = true)
      @NotNull(message = "isControl cannot be null")
      private Boolean isControl;
  
      public Boolean getIsControl() {
              return isControl;
      }
  
  
      @CheckBoolean(fieldName = "isControl")
      public void setIsControl(Boolean isControl) {
              this.isControl = isControl;
      }
  
  public class BooleanValidator implements ConstraintValidator&lt;CheckBoolean,  Boolean&gt; {
  
      private String fieldName;
  
      @Override
      public void initialize(CheckBoolean constraintAnnotation) {
          this.fieldName = constraintAnnotation.fieldName();
      }
  
      @Override
      public boolean isValid(Boolean value, ConstraintValidatorContext context) {         
          context.disableDefaultConstraintViolation();
          context.buildConstraintViolationWithTemplate(
                  String.format("The control flag %s should be either true or false", fieldName))
                  .addConstraintViolation();
  
          if (value != null) {
              boolean isBoolean;
              if (value instanceof Boolean) {                 
                  isBoolean = ((Boolean)value).booleanValue();
                  System.out.println("var isBoolean: " +isBoolean);
                  return true;
              } else if (value instanceof Boolean &amp;&amp; Boolean.FALSE.equals(value)) {
                  isBoolean = ((Boolean)value).booleanValue();                    
                  return true;
              } else {
                  return false;
              }           
          }
  return false;
  }
  }
  </code></pre>
  
  <p>Exception:</p>