1
2
3
4
5
6
7 package org.mule.config.spring.parsers.assembly.configuration;
8
9 import java.util.Map;
10
11
12
13
14 public class TempWrapperPropertyConfiguration implements PropertyConfiguration
15 {
16
17 protected PropertyConfiguration delegate;
18 protected SimplePropertyConfiguration extra = new SimplePropertyConfiguration();
19 private boolean greedyIgnore;
20
21 public TempWrapperPropertyConfiguration(PropertyConfiguration delegate)
22 {
23 this(delegate, true);
24 }
25
26 public TempWrapperPropertyConfiguration(PropertyConfiguration delegate, boolean greedyIgnore)
27 {
28 this.delegate = delegate;
29 this.greedyIgnore = greedyIgnore;
30 }
31
32 public void addReference(String propertyName)
33 {
34 extra.addReference(propertyName);
35 }
36
37 public void addMapping(String propertyName, Map mappings)
38 {
39 extra.addMapping(propertyName, mappings);
40 }
41
42 public void addMapping(String propertyName, String mappings)
43 {
44 extra.addMapping(propertyName, mappings);
45 }
46
47 public void addMapping(String propertyName, ValueMap mappings)
48 {
49 extra.addMapping(propertyName, mappings);
50 }
51
52 public void addAlias(String alias, String propertyName)
53 {
54 extra.addAlias(alias, propertyName);
55 }
56
57 public void addCollection(String propertyName)
58 {
59 extra.addCollection(propertyName);
60 }
61
62 public void addIgnored(String propertyName)
63 {
64 extra.addIgnored(propertyName);
65 }
66
67 public void removeIgnored(String propertyName)
68 {
69 extra.removeIgnored(propertyName);
70 }
71
72 public void setIgnoredDefault(boolean ignoreAll)
73 {
74 extra.setIgnoredDefault(ignoreAll);
75 }
76
77 public String getAttributeMapping(String alias)
78 {
79 return extra.getAttributeMapping(alias, delegate.getAttributeMapping(alias));
80 }
81
82 public String getAttributeAlias(String mapping)
83 {
84 return extra.getAttributeMapping(mapping, delegate.getAttributeAlias(mapping));
85 }
86
87 public boolean isCollection(String propertyName)
88 {
89 return extra.isCollection(propertyName) || delegate.isCollection(propertyName);
90 }
91
92 public boolean isIgnored(String propertyName)
93 {
94 if (greedyIgnore)
95 {
96 return extra.isIgnored(propertyName) || delegate.isIgnored(propertyName);
97 }
98 else
99 {
100 return extra.isIgnored(propertyName) && delegate.isIgnored(propertyName);
101 }
102 }
103
104 public boolean isReference(String attributeName)
105 {
106 return extra.isReference(attributeName) || delegate.isReference(attributeName);
107 }
108
109 public SingleProperty getSingleProperty(String propertyName)
110 {
111 return new SinglePropertyWrapper(propertyName, this);
112 }
113
114 public String translateName(String oldName)
115 {
116 return extra.translateName(delegate.translateName(oldName));
117 }
118
119 public Object translateValue(String name, String value)
120 {
121 Object intermediate = delegate.translateValue(name, value);
122 if (intermediate != null && intermediate.equals(value))
123 {
124 return extra.translateValue(name, value);
125 }
126 else
127 {
128 return intermediate;
129 }
130 }
131
132 }