1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.config.spring.parsers.delegate; |
8 | |
|
9 | |
import org.mule.config.spring.parsers.MuleChildDefinitionParser; |
10 | |
import org.mule.config.spring.parsers.MuleDefinitionParser; |
11 | |
import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; |
12 | |
|
13 | |
public class SingleParentFamilyDefinitionParser extends AbstractSingleParentFamilyDefinitionParser |
14 | |
{ |
15 | |
|
16 | |
public SingleParentFamilyDefinitionParser(MuleDefinitionParser parent) |
17 | 0 | { |
18 | |
|
19 | 0 | super.addDelegate(parent); |
20 | 0 | parent.setIgnoredDefault(false); |
21 | 0 | } |
22 | |
|
23 | |
protected MuleDefinitionParserConfiguration addDelegate(MuleDefinitionParser delegate) |
24 | |
{ |
25 | 0 | throw new UnsupportedOperationException("Delegates must be associated with attribute names"); |
26 | |
} |
27 | |
|
28 | |
public SingleParentFamilyDefinitionParser addChildDelegate(String attribute, MuleChildDefinitionParser delegate) |
29 | |
{ |
30 | 0 | return addChildDelegate(new String[]{attribute}, delegate); |
31 | |
} |
32 | |
|
33 | |
public SingleParentFamilyDefinitionParser addChildDelegate(String[] attributes, MuleChildDefinitionParser delegate) |
34 | |
{ |
35 | 0 | super.addChildDelegate(delegate); |
36 | 0 | delegate.setIgnoredDefault(true); |
37 | 0 | for (int i = 0; i < attributes.length; i++) |
38 | |
{ |
39 | 0 | getDelegate(0).addIgnored(attributes[i]); |
40 | 0 | delegate.removeIgnored(attributes[i]); |
41 | |
} |
42 | 0 | return this; |
43 | |
} |
44 | |
|
45 | |
} |
46 | |
|