| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FieldGetterFactory |
|
| 1.0;1 |
| 1 | package org.jtheque.primary.utils.web.analyzers.generic.field; | |
| 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.FactoryContainer; | |
| 7 | ||
| 8 | /* | |
| 9 | * This file is part of JTheque. | |
| 10 | * | |
| 11 | * JTheque is free software: you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation, either version 3 of the License. | |
| 14 | * | |
| 15 | * JTheque is distributed in the hope that it will be useful, | |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | * GNU General Public License for more details. | |
| 19 | * | |
| 20 | * You should have received a copy of the GNU General Public License | |
| 21 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 22 | */ | |
| 23 | ||
| 24 | /** | |
| 25 | * A factory for FieldGetter elements. | |
| 26 | * | |
| 27 | * @author Baptiste Wicht | |
| 28 | */ | |
| 29 | public final class FieldGetterFactory { | |
| 30 | 0 | private static final FactoryContainer<FieldGetter> FACTORY = new FactoryContainer<FieldGetter>(); |
| 31 | ||
| 32 | /** | |
| 33 | * This an utility class, not instanciable. | |
| 34 | */ | |
| 35 | private FieldGetterFactory(){ | |
| 36 | 0 | super(); |
| 37 | 0 | } |
| 38 | ||
| 39 | static{ | |
| 40 | 0 | FACTORY.add(new DisabledFieldGetterFactory()); |
| 41 | 0 | FACTORY.add(new MultiLineFieldGetterFactory()); |
| 42 | 0 | FACTORY.add(new SimpleFieldGetterFactory()); |
| 43 | 0 | } |
| 44 | ||
| 45 | /** | |
| 46 | * Return the field getter on the element. | |
| 47 | * | |
| 48 | * @param element The element to get the value getter for. | |
| 49 | * @param reader The reader to use. | |
| 50 | * | |
| 51 | * @return The factored FieldGetter to use. | |
| 52 | * | |
| 53 | * @throws XMLException If an error occurs during the XML processing. | |
| 54 | */ | |
| 55 | public static FieldGetter getFieldGetter(Element element, XMLReader reader) throws XMLException{ | |
| 56 | 0 | return FACTORY.getFactoredObject(element, reader); |
| 57 | } | |
| 58 | } |