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