Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 37 |  | Methods: | 2
| NCLOC: | 21 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
SourceTypeHandlerBroker.java | 50% | 75% | 50% | 62.5% |

1 |  | package net.sourceforge.pmd.sourcetypehandlers;
2 |  |
3 |  | import java.util.Map;
4 |  |
5 |  | import net.sourceforge.pmd.SourceType;
6 |  | import net.sourceforge.pmd.util.CollectionUtil;
7 |  |
8 |  | /**
9 |  | * Broker for SourceTypeHandler instances for specific SourceTypes.
10 |  | *
11 |  | * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
12 |  | */
13 |  | public class SourceTypeHandlerBroker {
14 |  |
15 |  | private static final Map mapSourceTypeOnSourceTypeHandler = CollectionUtil.mapFrom( new Object[][] {
16 |  | { SourceType.JAVA_13, new Java13Handler()},
17 |  | { SourceType.JAVA_14, new Java14Handler()},
18 |  | { SourceType.JAVA_15, new Java15Handler()},
19 |  | { SourceType.JAVA_16, new Java16Handler()},
20 |  | { SourceType.JSP, new JspTypeHandler()},
21 |  | });
22 |  |
23 |  | /**
24 |  | * Never create one
25 |  | */
26 | 0 | private SourceTypeHandlerBroker() { }
27 |  |
28 | 1260 | public static SourceTypeHandler getVisitorsFactoryForSourceType(SourceType sourceType) {
29 | 1260 | SourceTypeHandler handler = (SourceTypeHandler) mapSourceTypeOnSourceTypeHandler.get(sourceType);
30 |  |
31 | 1260 | if (handler == null) {
32 | 0 | throw new IllegalArgumentException("No VisitorsFactory is registered for SourceType [" + sourceType + "].");
33 |  | }
34 | 1260 | return handler;
35 |  | }
36 |  |
37 |  | }