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