title: Deserialize Json to java object
body: <p>I am using Lombok to create builder pattern for my java object and I want to convert json into this object but it keeps saying cannot deserialize object.</p>
  
  <pre><code>@Builder
  @Getter
  @Setter
  @Value
  @NoArgConstructor
  @JsonDeserialize()
  @JsonInclude(JsonInclude.Include.NON_NULL)
  @JsonIgnoreProperties(ignoreUnknown = true)
  public class SaleInfo {
        private String country;
        private String saleability; //This
        private boolean isEbook; //THis
       // created only if required
        private String buyLink;
  
      //TODO i want to have a conditional creation of this two objects below.
        ListPrice listPrice;
        RetailPrice retailPrice;
  
      @Override
      public boolean equals(Object o) {
          return EqualsBuilder.reflectionEquals(this, o);
      }
  
      @Override
      public int hashCode() {
          return HashCodeBuilder.reflectionHashCode(this);
      }
  
      @Override
      public String toString() {
          return ReflectionToStringBuilder.toString(this);
      }
  </code></pre>
  
  <p>This is my code for using object mapper</p>
  
  <pre><code>public NodeBean readFromJsonFile() throws IOException {
      objectMapper.configure(
          DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
          InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("book.json");
          JsonNode node = objectMapper.readTree(resourceAsStream);
          NodeBean nodebean = objectMapper.readerFor(NodeBean.class).readValue(node);
      return nodebean;
  }
  </code></pre>
  
  <p>It works fine when I implemented getters and setters and remove all lombok annotations, but I need it as a builder pattern, it's important (due to some optional objects like Listprice).  </p>
  
  <p>I am getting the error when i try to deserialize </p>
  
  <pre><code>com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.valentine.cognifide_task.model.SaleInfo` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
   at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.valentine.cognifide_task.model.NodeBean["items"]-&gt;java.util.ArrayList[0]-&gt;com.valentine.cognifide_task.model.Item["saleInfo"])
  </code></pre>
  
  <p>This is the json , The other parts of the json i have the objects and they are ok only the saleInfo has issues as the field are changing sometimes it has Listprice and sometimes not, SO i want a builder class that will only create it if needed.</p>
  
  <pre><code> {
        "kind": "books#volume",
        "id": "UEdjAgAAQBAJ",
        "etag": "/KAuiIWJuB4",
        "selfLink": "https://www.googleapis.com/books/v1/volumes/UEdjAgAAQBAJ",
        "volumeInfo": {
          "title": "Java. Podstawy. Wydanie IX",
          "authors": [
            "Cay S. Horstmann",
            "Gary Cornell"
          ],
          "publisher": "Helion",
          "publishedDate": "2013-12-09",
          "description": "Kolejne wydanie tej cenionej książki zostało zaktualizowane o wszystkie nowości, które pojawiły się w wersji 7 platformy Java Standard Edition. W trakcie lektury poznasz składnię języka oraz wszystkie istotne kwestie związane z programowaniem w Javie. Zrozumiesz założenia programowania obiektowego, nauczysz się korzystać z interfejsów oraz obsługiwać wyjątki. Przekonasz się również, jakie ułatwienia w tym zakresie oferuje Java 7 obsługa wielu wyjątków w ramach jednego bloku catch to tylko czubek góry lodowej.",
          "industryIdentifiers": [
            {
              "type": "ISBN_13",
              "identifier": "9788324677610"
            },
            {
              "type": "ISBN_10",
              "identifier": "8324677615"
            }
          ],
          "readingModes": {
            "text": true,
            "image": true
          },
          "pageCount": 864,
          "printType": "BOOK",
          "categories": [
            "Computers"
          ],
          "maturityRating": "NOT_MATURE",
          "allowAnonLogging": true,
          "contentVersion": "2.5.4.0.preview.3",
          "imageLinks": {
            "smallThumbnail": "http://books.google.com/books/content?id=UEdjAgAAQBAJ&amp;printsec=frontcover&amp;img=1&amp;zoom=5&amp;edge=curl&amp;source=gbs_api",
            "thumbnail": "http://books.google.com/books/content?id=UEdjAgAAQBAJ&amp;printsec=frontcover&amp;img=1&amp;zoom=1&amp;edge=curl&amp;source=gbs_api"
          },
          "language": "pl",
          "previewLink": "http://books.google.pl/books?id=UEdjAgAAQBAJ&amp;pg=PA852&amp;dq=java&amp;hl=&amp;cd=4&amp;source=gbs_api",
          "infoLink": "https://play.google.com/store/books/details?id=UEdjAgAAQBAJ&amp;source=gbs_api",
          "canonicalVolumeLink": "https://market.android.com/details?id=book-UEdjAgAAQBAJ"
        },
        "saleInfo": {
          "country": "PL",
          "saleability": "FOR_SALE",
          "isEbook": true,
          "listPrice": {
            "amount": 79.0,
            "currencyCode": "PLN"
          },
          "retailPrice": {
            "amount": 55.3,
            "currencyCode": "PLN"
          },
          "buyLink": "https://play.google.com/store/books/details?id=UEdjAgAAQBAJ&amp;rdid=book-UEdjAgAAQBAJ&amp;rdot=1&amp;source=gbs_api",
          "offers": [
            {
              "finskyOfferType": 1,
              "listPrice": {
                "amountInMicros": 7.9E7,
                "currencyCode": "PLN"
              },
              "retailPrice": {
                "amountInMicros": 5.53E7,
                "currencyCode": "PLN"
              }
            }
          ]
        },
        "accessInfo": {
          "country": "PL",
          "viewability": "PARTIAL",
          "embeddable": true,
          "publicDomain": false,
          "textToSpeechPermission": "ALLOWED",
          "epub": {
            "isAvailable": true,
            "acsTokenLink": "http://books.google.pl/books/download/Java_Podstawy_Wydanie_IX-sample-epub.acsm?id=UEdjAgAAQBAJ&amp;format=epub&amp;output=acs4_fulfillment_token&amp;dl_type=sample&amp;source=gbs_api"
          },
          "pdf": {
            "isAvailable": true,
            "acsTokenLink": "http://books.google.pl/books/download/Java_Podstawy_Wydanie_IX-sample-pdf.acsm?id=UEdjAgAAQBAJ&amp;format=pdf&amp;output=acs4_fulfillment_token&amp;dl_type=sample&amp;source=gbs_api"
          },
          "webReaderLink": "http://play.google.com/books/reader?id=UEdjAgAAQBAJ&amp;hl=&amp;printsec=frontcover&amp;source=gbs_api",
          "accessViewStatus": "SAMPLE",
          "quoteSharingAllowed": false
        },
        "searchInfo": {
          "textSnippet": "MF, 512 manifestu klasa główna, 514 sekcja główna, 512 wstawianie sekcji, 518 \u003cbr\u003e\nzmienianie zawartości, 513 MapTest.\u003cb\u003ejava\u003c/b\u003e,699 MenuFrame.\u003cb\u003ejava\u003c/b\u003e, 442 \u003cbr\u003e\nMethodTableTest.\u003cb\u003ejava\u003c/b\u003e,266 MouseComponent.\u003cb\u003ejava\u003c/b\u003e, 383 MouseFrame.\u003cb\u003ejava\u003c/b\u003e, 383 \u003cbr\u003e\nNotHelloWorld.\u003cb\u003ejava\u003c/b\u003e, 330, 534 ObjectAnalyzerTest.\u003cb\u003ejava\u003c/b\u003e,259 OptionDialogFrame.\u003cbr\u003e\n\u003cb\u003ejava\u003c/b\u003e,477 overview.html, 194 PackageTest.\u003cb\u003ejava\u003c/b\u003e, 184 PairTest1.\u003cb\u003ejava\u003c/b\u003e, 631 \u003cbr\u003e\nPairTest2.\u003cb\u003ejava\u003c/b\u003e, 634 PairTest3.\u003cb\u003ejava\u003c/b\u003e, 656 ParamTest.\u003cb\u003ejava\u003c/b\u003e, 169 PasswordChooser.\u003cbr\u003e\n\u003cb\u003ejava\u003c/b\u003e, 492 Person.\u003cb\u003ejava\u003c/b\u003e&amp;nbsp;..."
        }
      },
  </code></pre>