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.PostProcessor;
10  import org.mule.config.spring.parsers.assembly.BeanAssembler;
11  
12  import org.w3c.dom.Attr;
13  import org.w3c.dom.Element;
14  import org.springframework.beans.factory.xml.ParserContext;
15  
16  public class ExtendTarget implements PostProcessor
17  {
18  
19      private String name;
20      private String value;
21  
22      public ExtendTarget(String name, String value)
23      {
24          this.name = name;
25          this.value = value;
26      }
27  
28      public void postProcess(ParserContext unused, BeanAssembler assembler, Element element)
29      {
30          Attr attribute = element.getOwnerDocument().createAttribute(name);
31          attribute.setNodeValue(value);
32          assembler.extendTarget(attribute);
33      }
34  
35  }