title: Customize Jackson ObjectMapper to Read custom Annotation and mask fields annotated
body: <p>I have a requirement where I have created a Custom Annotation @MaskSensitiveData. I annotate sensitive fields. like</p>
  
  <pre><code>class MyBean {
      String userName;
      @MaskSensitiveData
      String cardNumber;
      String abc;
      String xyz;
  }
  
  ObjectMapper mapper = new ObjectMapper();
      String json = null;
      AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
      AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
      AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
      mapper.setAnnotationIntrospector(pair);
      try {
          json = mapper.writeValueAsString(obj);
          /*
           * if(json != null ) { json = getLoggableString(json); }
           */
      } catch (Exception e) {
          return "Unable to convert to Json object:" + obj.toString() + " Message: " + e.getMessage();
  
      }
  </code></pre>
  
  <p>I am using Jackson ObjectMapper to convert objct to Json like.
  <strong>I need to customize Object Mapper to mask cardNumber field in return json</strong>.
  Please suggest a better way.</p>