title: Is there a way to auto generate a flatten pojo from a pojo with object composition
body: <p>I need to store documents into Elasticsearch indexes and therefor I defined a mapping. From my java client I need to supply it with pojo's which looks like the Compony class. It has a lot of duplicated values. I could use object composition pattern to solve this, but Elasticsearch can't handle that kind of structure and therefor it expects a flatten structure.</p>
  
  <pre class="lang-java prettyprint-override"><code>class Company {
      private String postalstreetName;
      private String postalHouseNumer;
      private String postalHouseLetter;
      private String postalHouseNumberAddition;
      private String postalZipCode;
      private String postalCity;
      private String postalCountry;
  
      private String visitorstreetName;
      private String visitorHouseNumer;
      private String visitorHouseLetter;
      private String visitorHouseNumberAddition;
      private String visitorZipCode;
      private String visitorCity;
      private String visitorCountry;
  
      private String establishmentstreetName;
      private String establishmentHouseNumer;
      private String establishmentHouseLetter;
      private String establishmentHouseNumberAddition;
      private String establishmentZipCode;
      private String establishmentCity;
      private String establishmentCountry;
  }
  </code></pre>
  
  <p>I actually want pojo's like below and somehow auto generate the pojo above with the same naming structure.</p>
  
  <pre class="lang-java prettyprint-override"><code>class Address {
      private String streetName;
      private String houseNumer;
      private String houseLetter;
      private String houseNumberAddition;
      private String zipCode;
      private String city;
      private String country;
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>class Company {
      private Address postalAddress;
      private Address visitorAddress;
      private Address establishmentAddress;
  }
  </code></pre>
  
  <p>Does someone know if something like this is possible, to auto generate a flatten pojo from a pojo with object composition with a name prefix for all the fields? </p>