01: /*
02: * $Id: ListPropertyDefinitionParser.java 10268 2008-01-09 19:42:09Z acooke $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.config.spring.parsers.specific.properties;
12:
13: import org.mule.config.spring.parsers.assembly.MapEntryCombiner;
14: import org.mule.config.spring.parsers.generic.ParentDefinitionParser;
15:
16: import org.w3c.dom.Element;
17:
18: /**
19: * This allows a child element to extends a list of values, via an attribute, on a parent setter.
20: * Typically it is used with
21: * {@link org.mule.config.spring.parsers.specific.properties.ElementInNestedMapDefinitionParser}
22: * whose setter is {@link org.mule.config.spring.parsers.assembly.MapEntryCombiner#VALUE}.
23: */
24: public class ListPropertyDefinitionParser extends
25: ParentDefinitionParser {
26:
27: public ListPropertyDefinitionParser(String attribute) {
28: this (MapEntryCombiner.VALUE, attribute);
29: }
30:
31: /**
32: * This method is to explain how things work. If you need to call it, then you also need to replace
33: * override the class ({#link #getBeanClass}).
34: *
35: * @param setter
36: * @param attribute
37: */
38: protected ListPropertyDefinitionParser(String setter,
39: String attribute) {
40: setIgnoredDefault(true);
41: removeIgnored(attribute);
42: addCollection(attribute);
43: if (!setter.equals(attribute)) {
44: addAlias(attribute, setter);
45: }
46: }
47:
48: protected Class getBeanClass(Element element) {
49: return MapEntryCombiner.class;
50: }
51:
52: }
|