title: Setting default values to null fields when mapping with Jackson
body: <p>I am trying to map some JSON objects to Java objects with Jackson. Some of the fields in the JSON object are mandatory(which I can mark with <code>@NotNull</code>) and some are optional.</p>
  
  <p>After the mapping with Jackson, all the fields that are not set in the JSON object will have a null value in Java. Is there a similar annotation to <code>@NotNull</code> that can tell Jackson to set a default value to a Java class member, in case it is null?</p>
  
  <p>Edit:
  To make the question more clear here is some code example.</p>
  
  <p>The Java object:</p>
  
  <pre><code>class JavaObject {
      @NotNull
      public String notNullMember;
  
      @DefaultValue("Value")
      public String optionalMember;
  }
  </code></pre>
  
  <p>The JSON object can be either:</p>
  
  <pre><code>{
      "notNullMember" : "notNull"
  }
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>{
      "notNullMember" : "notNull",
      "optionalMember" : "optional"
  }
  </code></pre>
  
  <p>The <code>@DefaultValue</code> annotations is just to show what I am asking. It's not a real annotation. If the JSON object is like in the first example I want the value of the <code>optionalMember</code> to be <code>"Value"</code> and not <code>null</code>. Is there an annotation that does such a thing?</p>