Esempio n. 1
0
  public Object copyTo(Object target, CopyBuilder copyBuilder) {
    Country copy = (target == null) ? new Country() : (Country) target;

    if (isSetAddressLine()) {
      for (AddressLine part : addressLine) {
        AddressLine copyPart = (AddressLine) copyBuilder.copy(part);
        copy.addAddressLine(copyPart);

        if (part != null && copyPart == part) part.setParent(this);
      }
    }

    if (isSetCountryName()) {
      for (CountryName part : countryName) {
        CountryName copyPart = (CountryName) copyBuilder.copy(part);
        copy.addCountryName(copyPart);

        if (part != null && copyPart == part) part.setParent(this);
      }
    }

    if (isSetCountryNameCode()) {
      for (CountryNameCode part : countryNameCode) {
        CountryNameCode copyPart = (CountryNameCode) copyBuilder.copy(part);
        copy.addCountryNameCode(copyPart);

        if (part != null && copyPart == part) part.setParent(this);
      }
    }

    if (isSetAdministrativeArea()) {
      copy.setAdministrativeArea((AdministrativeArea) copyBuilder.copy(administrativeArea));
      if (copy.getAdministrativeArea() == administrativeArea) administrativeArea.setParent(this);
    }

    if (isSetLocality()) {
      copy.setLocality((Locality) copyBuilder.copy(locality));
      if (copy.getLocality() == locality) locality.setParent(this);
    }

    if (isSetThoroughfare()) {
      copy.setThoroughfare((Thoroughfare) copyBuilder.copy(thoroughfare));
      if (copy.getThoroughfare() == thoroughfare) thoroughfare.setParent(this);
    }

    copy.unsetParent();

    return copy;
  }