title: jackson serialization of nested objects
body: <p>I have problem with jackson serialization of object by its interface.</p>
  
  <p>I have class</p>
  
  <pre><code>class Point implements PointView {
  
      private String id;
  
      private String name;
  
      public Point() {
  
      }
  
      public Point(String id, String name) {
          this.id = id;
          this.name = name;
      }
  
      @Override
      public String getId() {
          return id;
      }
  
      public String getName() {
          return name;
      }
  
  }
  </code></pre>
  
  <p>which implements </p>
  
  <pre><code>interface PointView {
      String getId();
  }
  </code></pre>
  
  <p>and have class</p>
  
  <pre><code>class Map implements MapView {
  
      private String id;
  
      private String name;
  
      private Point point;
  
      public Map() {
  
      }
  
      public Map(String id, String name, Point point) {
          this.id = id;
          this.name = name;
          this.point = point;
      }
  
      @Override
      public String getId() {
          return id;
      }
  
      public String getName() {
          return name;
      }
  
      @JsonSerialize(as = PointView.class)
      public Point getPoint() {
          return point;
      }
  
  }
  </code></pre>
  
  <p>which implements </p>
  
  <pre><code>interface MapView {
      String getId();
      Point getPoint();
  }
  </code></pre>
  
  <p>And have class </p>
  
  <pre><code>class Container {
  
      private Map map;
  
      public Container() {
  
      }
  
      public Container(Map map) {
          this.map = map;
      }
  
      @JsonSerialize(as = MapView.class)
      public Map getMap() {
          return map;
      }
  }
  </code></pre>
  
  <p>I want serialize Container with Jackson and get result</p>
  
  <pre><code>{"map":{"id":"mapId","point":{"id":"pointId"}}}
  </code></pre>
  
  <p>But in fact I get result</p>
  
  <pre><code>{"map":{"id":"mapId","point":{"id":"pointId","name":"pointName"}}}
  </code></pre>
  
  <p>that have property "name" in nested object "point" although I specified serializition type of Point in Map (<code>@JsonSerialize(as = PointView.class)</code>). Interface PointView dont have method getName, but in result exists field "name" of Point.</p>
  
  <p>If I remove annotation (<code>@JsonSerialize(as = MapView.class)</code>) from method getMap in class Container I get result </p>
  
  <pre><code>{"map":{"id":"mapId","name":"mapName","point":{"id":"pointId"}}}
  </code></pre>
  
  <p>Now point dont have property "name", but map have.</p>
  
  <p>How can I get result</p>
  
  <pre><code>{"map":{"id":"mapId","point":{"id":"pointId"}}}
  </code></pre>
  
  <p>?</p>