Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CheckRequiredAttributesWhenNoChildren |
|
| 2.0;2 |
1 | /* | |
2 | * $Id: CheckRequiredAttributesWhenNoChildren.java 20320 2010-11-24 15:03:31Z 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.processors; | |
12 | ||
13 | import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; | |
14 | ||
15 | import org.w3c.dom.Element; | |
16 | ||
17 | /** | |
18 | * All attributes from at least one set must be provided when there are no child | |
19 | * elements with the name specified present. | |
20 | */ | |
21 | public class CheckRequiredAttributesWhenNoChildren extends CheckRequiredAttributes | |
22 | { | |
23 | private String elementName; | |
24 | ||
25 | public CheckRequiredAttributesWhenNoChildren(String[][] attributeNames, String elementName) | |
26 | { | |
27 | 0 | super(attributeNames); |
28 | 0 | this.elementName = elementName; |
29 | 0 | } |
30 | ||
31 | public void preProcess(PropertyConfiguration config, Element element) | |
32 | { | |
33 | // If there are child elements we skip this check | |
34 | 0 | if (element.getElementsByTagName(elementName).getLength() > 0) |
35 | { | |
36 | 0 | return; |
37 | } | |
38 | 0 | super.preProcess(config, element); |
39 | 0 | } |
40 | } |