title: Best way to write pojos that can have common fields
body: <p>I am currently making a service in which there are lots of public API's. And the response and request objects overlap a lot. So, I was thinking that is there a way by which we can generalise the pojo creation for the request/response objects.
  Sometimes the response object is identical to the request object with one or two extra fields.</p>
  
  <p>Let me give you an example.</p>
  
  <pre><code>@Data
  public class Request {
      private A objA;
      private B objB;
  }
  
  @Data
  public class Response {
      private A objA;
      private B objB;
      private C objC;
  }
  
  @Data
  public class A {
      private D objD;
  }
  
  @Data
  public class B {
      private String sB; 
      private E obje;
  }
  
  @Data
  public class C {
      private String sC;
  }
  </code></pre>
  
  <hr>
  
  <p>Similary, D and E are pojos as well. The thing is that there is a lot of similarity(overlapping fields) in request/response objects. </p>