title: Jackson: using builder with nondefault constructor
body: <p>I have the following class:
      </p>
  
  <pre><code>@JsonDeserialize(builder = Transaction.Builder.class)
  public final class Transaction {
  
      @JacksonXmlText
      private final TransactionType transactionType;
      @JacksonXmlProperty(isAttribute = true)
      private final boolean transactionAllowed;
  
      private Transaction(Builder builder) {
          transactionType = builder.transactionType;
          transactionAllowed = builder.transactionAllowed;
      }
  
      public static final class Builder {
          private final TransactionType transactionType;
          private boolean transactionAllowed;
  
          public Builder(TransactionType transactionType) {
              this.transactionType = transactionType;
          }
  
          public Builder withTransactionAllowed() {
              transactionAllowed = true;
              return this;
          }
  
          public Transaction build() {
              return new Transaction(this);
          }
      }
  }
  </code></pre>
  
  <p><code>TransactionType</code> is a simple enum:
      </p>
  
  <pre><code>public enum TransactionType {
      PU,
      CV;
  }
  </code></pre>
  
  <p>When I create a new Transaction instance and serialize it using Jackson mapper I get the following xml:</p>
  
  <pre><code>&lt;transaction transactionAllowed="true"&gt;PU&lt;/transaction&gt;
  </code></pre>
  
  <p>The problem is that I cannot deserialize it. I get the following exception:</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException:
  No suitable constructor found for type [simple type, class Transaction$Builder]
  </code></pre>
  
  <p>If I put @JsonCreator on the Builder constructor like this:
      </p>
  
  <pre><code>@JsonCreator
  public Builder(TransactionType transactionType) {
      this.transactionType = transactionType;
  }
  </code></pre>
  
  <p>I get the following exception:</p>
  
  <pre><code>com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct
  instance of Transaction from String value 'transactionAllowed': value not one of
  declared Enum instance names: [PU, CV]
  </code></pre>
  
  <p>If I then put @JsonProperty on the constructor parameter like this:
      </p>
  
  <pre><code>@JsonCreator
  public Builder(@JsonProperty TransactionType transactionType) {
      this.transactionType = transactionType;
  }
  </code></pre>
  
  <p>I get another error:</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException: Could not find creator
  property with name '' (in class Transaction$Builder)
  </code></pre>
  
  <p>Any ideas how to get around this?</p>