Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ListPropertyDefinitionParser |
|
| 1.3333333333333333;1.333 |
1 | /* | |
2 | * $Id: ListPropertyDefinitionParser.java 20321 2010-11-24 15:21:24Z dfeist $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
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 ParentDefinitionParser | |
25 | { | |
26 | ||
27 | public ListPropertyDefinitionParser(String attribute) | |
28 | { | |
29 | 0 | this(MapEntryCombiner.VALUE, attribute); |
30 | 0 | } |
31 | ||
32 | /** | |
33 | * This method is to explain how things work. If you need to call it, then you also need to replace | |
34 | * override the class ({#link #getBeanClass}). | |
35 | * | |
36 | * @param setter | |
37 | * @param attribute | |
38 | */ | |
39 | protected ListPropertyDefinitionParser(String setter, String attribute) | |
40 | 0 | { |
41 | 0 | setIgnoredDefault(true); |
42 | 0 | removeIgnored(attribute); |
43 | 0 | addCollection(attribute); |
44 | 0 | if (!setter.equals(attribute)) |
45 | { | |
46 | 0 | addAlias(attribute, setter); |
47 | } | |
48 | 0 | } |
49 | ||
50 | protected Class getBeanClass(Element element) | |
51 | { | |
52 | 0 | return MapEntryCombiner.class; |
53 | } | |
54 | ||
55 | } |