View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.config.spring.parsers.processors;
8   
9   import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
10  import org.mule.config.spring.parsers.PreProcessor;
11  import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
12  import org.mule.config.spring.parsers.generic.AutoIdUtils;
13  
14  import org.w3c.dom.Element;
15  
16  public class ProvideDefaultNameFromElement implements PreProcessor
17  {
18  
19      public void preProcess(PropertyConfiguration config, Element element)
20      {
21          if (AutoIdUtils.blankAttribute(element, AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME))
22          {
23              element.setAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME, element.getLocalName());
24          }
25      }
26  
27  }