title: How to check JSON field is empty and null
body: <p>I'm trying to check JSON field empty or null, it is working for the empty string and not working for null</p>
  
  <p>Lombok I just used to override ToString, but I'm using Jackson library </p>
  
  <pre><code>import lombok.ToString;
  
  @ToString
  public class DefaultModel {
  
      private String name;
      private String age;  
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getAge() {
          return age;
      }
  
      public void setAge(String age) {
          if (age.trim().isEmpty()||age==null) {
              this.age="101";
          } else {
              this.age=age;
          }
      }
  }
  </code></pre>
  
  <p>This is controller:</p>
  
  <pre><code>@RequestMapping(value="/default", method=RequestMethod.POST)
  public DefaultModel m1(@RequestBody() DefaultModel model) {
      System.out.println(model);
      return model;
  }
  </code></pre>
  
  <p>It's working for empty string but not when i haven't pass JSON field in body</p>
  
  <p>Failure case:</p>
  
  <pre><code>{
      "name":"some"
  }
  </code></pre>
  
  <p>I know another case is stupidity but I tried, and also I don't even want to give .1% for this null values</p>
  
  <pre><code>{
      "name":"some",
      "age":null
  }
  </code></pre>