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.specific.endpoint.support;
8   
9   import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
10  import org.mule.config.spring.parsers.processors.AddAttribute;
11  import org.mule.endpoint.URIBuilder;
12  
13  /**
14   * Generate an Endpoint URI from simple address components.
15   */
16  public class ChildAddressDefinitionParser extends ChildDefinitionParser
17  {
18  
19      public static final boolean META = true;
20      public static final boolean PROTOCOL = false;
21  
22      public ChildAddressDefinitionParser(String protocol)
23      {
24          this(protocol, PROTOCOL);
25      }
26  
27      public ChildAddressDefinitionParser(String metaOrProtocol, boolean isMeta)
28      {
29          super(EndpointUtils.URI_BUILDER_ATTRIBUTE, URIBuilder.class);
30          registerPreProcessor(
31                  new AddAttribute(
32                          isMeta ? URIBuilder.META : URIBuilder.PROTOCOL,
33                          metaOrProtocol));
34      }
35  
36  }