Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractValueGetterFactory |
|
| 4.0;4 |
1 | package org.jtheque.primary.utils.web.analyzers.generic.value; | |
2 | ||
3 | import org.jdom.Element; | |
4 | import org.jtheque.core.utils.file.XMLException; | |
5 | import org.jtheque.core.utils.file.XMLReader; | |
6 | import org.jtheque.primary.utils.web.analyzers.generic.Factory; | |
7 | import org.jtheque.primary.utils.web.analyzers.generic.condition.Condition; | |
8 | import org.jtheque.primary.utils.web.analyzers.generic.condition.ConditionFactory; | |
9 | ||
10 | /* | |
11 | * This file is part of JTheque. | |
12 | * | |
13 | * JTheque is free software: you can redistribute it and/or modify | |
14 | * it under the terms of the GNU General Public License as published by | |
15 | * the Free Software Foundation, either version 3 of the License. | |
16 | * | |
17 | * JTheque is distributed in the hope that it will be useful, | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | * GNU General Public License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License | |
23 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
24 | */ | |
25 | ||
26 | /** | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | 0 | public abstract class AbstractValueGetterFactory implements Factory<ValueGetter> { |
30 | /** | |
31 | * Return the condition contained in a specific location of a specific node. | |
32 | * | |
33 | * @param currentNode The node to search in. | |
34 | * @param location The location to search in. | |
35 | * @param reader The XML Reader | |
36 | * @return The Condition or null if we doesn't found one. | |
37 | * @throws XMLException If an errors occurs during the parse of the XML Elements. | |
38 | */ | |
39 | static Condition getCondition(Object currentNode, String location, XMLReader reader) throws XMLException { | |
40 | 0 | Object conditionNode = reader.getNode(location, currentNode); |
41 | ||
42 | 0 | if (conditionNode != null) { |
43 | 0 | Element node = reader.getNode("*", conditionNode); |
44 | ||
45 | 0 | if (node != null) { |
46 | 0 | return ConditionFactory.getCondition(node, reader); |
47 | } | |
48 | } | |
49 | ||
50 | 0 | return null; |
51 | } | |
52 | } |