1
2
3
4
5
6
7 package org.mule.config.spring.parsers.collection;
8
9 import org.mule.config.spring.parsers.assembly.BeanAssembler;
10 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
11 import org.mule.config.spring.util.SpringXMLUtils;
12
13 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
14 import org.springframework.beans.factory.xml.ParserContext;
15 import org.w3c.dom.Element;
16
17
18
19
20
21
22 public class ChildListEntryDefinitionParser extends ChildDefinitionParser
23 {
24
25 public static final String VALUE = "value";
26 private boolean fromText = true;
27
28
29
30
31
32
33 public ChildListEntryDefinitionParser(String propertyName)
34 {
35 super(propertyName, ListEntry.class);
36 setIgnoredDefault(true);
37 }
38
39
40
41
42
43
44
45 public ChildListEntryDefinitionParser(String propertyName, String attributeName)
46 {
47 this(propertyName);
48 addAlias(attributeName, VALUE);
49 removeIgnored(attributeName);
50 fromText = false;
51 }
52
53 protected void postProcess(ParserContext context, BeanAssembler assembler, Element element)
54 {
55 if (fromText)
56 {
57 assembler.extendBean(VALUE, SpringXMLUtils.getTextChild(element), false);
58 }
59 super.postProcess(context, assembler, element);
60 }
61
62 protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder)
63 {
64 super.parseChild(element, parserContext, builder);
65 }
66
67 public static class ListEntry
68 {
69
70 private Object value;
71
72 public ListEntry()
73 {
74 super();
75 }
76
77 public ListEntry(Object proxied)
78 {
79 this();
80 value = proxied;
81 }
82
83 public Object getValue()
84 {
85 return value;
86 }
87
88 public void setValue(Object value)
89 {
90 this.value = value;
91 }
92 }
93
94 }