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