/**
  * Merges the passed configuration into this one. Configuration values
  * of the passed configuration will overwrite the this one.
  *
  * @param \AppserverIo\Psr\EnterpriseBeans\Description\ServletDescriptorInterface $servletDescriptor The descriptor to merge
  *
  * @return void
  * @throws \AppserverIo\Psr\Servlet\ServletException Is thrown if you try to merge a servlet descriptor with a different class name
  */
 public function merge(ServletDescriptorInterface $servletDescriptor)
 {
     // check if the classes are equal
     if ($this->getClassName() !== $servletDescriptor->getClassName()) {
         throw new ServletException(sprintf('You try to merge a servlet descriptor for % with %s', $servletDescriptor->getClassName(), $servletDescriptor->getClassName()));
     }
     // merge the servlet name
     if ($name = $servletDescriptor->getName()) {
         $this->setName($name);
     }
     // merge the servlet description
     if ($description = $servletDescriptor->getDescription()) {
         $this->setDescription($description);
     }
     // merge the servlet display name
     if ($displayName = $servletDescriptor->getDisplayName()) {
         $this->setDisplayName($displayName);
     }
     // merge the URL patterns
     foreach ($servletDescriptor->getUrlPatterns() as $urlPattern) {
         $this->addUrlPattern($urlPattern);
     }
     // merge the initialization parameters
     foreach ($servletDescriptor->getInitParams() as $paramKey => $paramValue) {
         $this->addInitParam($paramKey, $paramValue);
     }
     // merge the EPB references
     foreach ($servletDescriptor->getEpbReferences() as $epbReference) {
         $this->addEpbReference($epbReference);
     }
     // merge the resource references
     foreach ($servletDescriptor->getResReferences() as $resReference) {
         $this->addResReference($resReference);
     }
     // merge the persistence unit references
     foreach ($servletDescriptor->getPersistenceUnitReferences() as $persistenceUnitReference) {
         $this->addPersistenceUnitReference($persistenceUnitReference);
     }
 }