Exemplo n.º 1
0
 public Object copyTo(ObjectLocator locator, Object target, CopyStrategy strategy) {
   final Object draftCopy = ((target == null) ? createNewInstance() : target);
   if (draftCopy instanceof SecureSocketSettings) {
     final SecureSocketSettings copy = ((SecureSocketSettings) draftCopy);
     if (this.mode != null) {
       SecureSocketModeEnum sourceMode;
       sourceMode = this.getMode();
       SecureSocketModeEnum copyMode =
           ((SecureSocketModeEnum)
               strategy.copy(LocatorUtils.property(locator, "mode", sourceMode), sourceMode));
       copy.setMode(copyMode);
     } else {
       copy.mode = null;
     }
     if (this.protocol != null) {
       String sourceProtocol;
       sourceProtocol = this.getProtocol();
       String copyProtocol =
           ((String)
               strategy.copy(
                   LocatorUtils.property(locator, "protocol", sourceProtocol), sourceProtocol));
       copy.setProtocol(copyProtocol);
     } else {
       copy.protocol = null;
     }
     if (this.certificateAuthorityFile != null) {
       String sourceCertificateAuthorityFile;
       sourceCertificateAuthorityFile = this.getCertificateAuthorityFile();
       String copyCertificateAuthorityFile =
           ((String)
               strategy.copy(
                   LocatorUtils.property(
                       locator, "certificateAuthorityFile", sourceCertificateAuthorityFile),
                   sourceCertificateAuthorityFile));
       copy.setCertificateAuthorityFile(copyCertificateAuthorityFile);
     } else {
       copy.certificateAuthorityFile = null;
     }
     if (this.clientCertificateFile != null) {
       String sourceClientCertificateFile;
       sourceClientCertificateFile = this.getClientCertificateFile();
       String copyClientCertificateFile =
           ((String)
               strategy.copy(
                   LocatorUtils.property(
                       locator, "clientCertificateFile", sourceClientCertificateFile),
                   sourceClientCertificateFile));
       copy.setClientCertificateFile(copyClientCertificateFile);
     } else {
       copy.clientCertificateFile = null;
     }
     if (this.clientKeyFile != null) {
       String sourceClientKeyFile;
       sourceClientKeyFile = this.getClientKeyFile();
       String copyClientKeyFile =
           ((String)
               strategy.copy(
                   LocatorUtils.property(locator, "clientKeyFile", sourceClientKeyFile),
                   sourceClientKeyFile));
       copy.setClientKeyFile(copyClientKeyFile);
     } else {
       copy.clientKeyFile = null;
     }
     if (this.clientKeyPassword != null) {
       String sourceClientKeyPassword;
       sourceClientKeyPassword = this.getClientKeyPassword();
       String copyClientKeyPassword =
           ((String)
               strategy.copy(
                   LocatorUtils.property(locator, "clientKeyPassword", sourceClientKeyPassword),
                   sourceClientKeyPassword));
       copy.setClientKeyPassword(copyClientKeyPassword);
     } else {
       copy.clientKeyPassword = null;
     }
     if (this.clientKeyPEM != null) {
       Boolean sourceClientKeyPEM;
       sourceClientKeyPEM = this.isClientKeyPEM();
       Boolean copyClientKeyPEM =
           ((Boolean)
               strategy.copy(
                   LocatorUtils.property(locator, "clientKeyPEM", sourceClientKeyPEM),
                   sourceClientKeyPEM));
       copy.setClientKeyPEM(copyClientKeyPEM);
     } else {
       copy.clientKeyPEM = null;
     }
     if (this.serverKeyStoreFile != null) {
       String sourceServerKeyStoreFile;
       sourceServerKeyStoreFile = this.getServerKeyStoreFile();
       String copyServerKeyStoreFile =
           ((String)
               strategy.copy(
                   LocatorUtils.property(locator, "serverKeyStoreFile", sourceServerKeyStoreFile),
                   sourceServerKeyStoreFile));
       copy.setServerKeyStoreFile(copyServerKeyStoreFile);
     } else {
       copy.serverKeyStoreFile = null;
     }
     if (this.serverKeyStorePassword != null) {
       String sourceServerKeyStorePassword;
       sourceServerKeyStorePassword = this.getServerKeyStorePassword();
       String copyServerKeyStorePassword =
           ((String)
               strategy.copy(
                   LocatorUtils.property(
                       locator, "serverKeyStorePassword", sourceServerKeyStorePassword),
                   sourceServerKeyStorePassword));
       copy.setServerKeyStorePassword(copyServerKeyStorePassword);
     } else {
       copy.serverKeyStorePassword = null;
     }
     if (this.clientKeyStoreFile != null) {
       String sourceClientKeyStoreFile;
       sourceClientKeyStoreFile = this.getClientKeyStoreFile();
       String copyClientKeyStoreFile =
           ((String)
               strategy.copy(
                   LocatorUtils.property(locator, "clientKeyStoreFile", sourceClientKeyStoreFile),
                   sourceClientKeyStoreFile));
       copy.setClientKeyStoreFile(copyClientKeyStoreFile);
     } else {
       copy.clientKeyStoreFile = null;
     }
     if (this.clientKeyStorePassword != null) {
       String sourceClientKeyStorePassword;
       sourceClientKeyStorePassword = this.getClientKeyStorePassword();
       String copyClientKeyStorePassword =
           ((String)
               strategy.copy(
                   LocatorUtils.property(
                       locator, "clientKeyStorePassword", sourceClientKeyStorePassword),
                   sourceClientKeyStorePassword));
       copy.setClientKeyStorePassword(copyClientKeyStorePassword);
     } else {
       copy.clientKeyStorePassword = null;
     }
     if ((this.property != null) && (!this.property.isEmpty())) {
       List<Property> sourceProperty;
       sourceProperty =
           (((this.property != null) && (!this.property.isEmpty())) ? this.getProperty() : null);
       @SuppressWarnings("unchecked")
       List<Property> copyProperty =
           ((List<Property>)
               strategy.copy(
                   LocatorUtils.property(locator, "property", sourceProperty), sourceProperty));
       copy.property = null;
       if (copyProperty != null) {
         List<Property> uniquePropertyl = copy.getProperty();
         uniquePropertyl.addAll(copyProperty);
       }
     } else {
       copy.property = null;
     }
   }
   return draftCopy;
 }