Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 47 |  | Methods: | 3
| NCLOC: | 24 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
SourceTypeHandlerBroker.java | 50% | 88.9% | 100% | 85.7% |

1 |  | package net.sourceforge.pmd.sourcetypehandlers;
2 |  |
3 |  | import net.sourceforge.pmd.SourceType;
4 |  |
5 |  | import java.util.HashMap;
6 |  | import java.util.Map;
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 |  | /**
16 |  | * Map of SourceType on SourceTypeHandler.
17 |  | */
18 |  | private Map mapSourceTypeOnSourceTypeHandler = new HashMap();
19 |  |
20 |  | /**
21 |  | * Public constructor.
22 |  | */
23 | 1055 | public SourceTypeHandlerBroker() {
24 | 1055 | initialize();
25 |  | }
26 |  |
27 |  | /**
28 |  | * Initialize the mapSourceTypeOnVisitorsFactory.
29 |  | */
30 | 1055 | private void initialize() {
31 | 1055 | mapSourceTypeOnSourceTypeHandler.put(SourceType.JAVA_13, new Java13Handler());
32 | 1055 | mapSourceTypeOnSourceTypeHandler.put(SourceType.JAVA_14, new Java14Handler());
33 | 1055 | mapSourceTypeOnSourceTypeHandler.put(SourceType.JAVA_15, new Java15Handler());
34 | 1055 | mapSourceTypeOnSourceTypeHandler.put(SourceType.JSP, new JspTypeHandler());
35 |  | }
36 |  |
37 | 1055 | public SourceTypeHandler getVisitorsFactoryForSourceType(SourceType sourceType) {
38 | 1055 | SourceTypeHandler handler = (SourceTypeHandler) mapSourceTypeOnSourceTypeHandler.get(sourceType);
39 |  |
40 | 1055 | if (handler == null) {
41 | 0 | throw new IllegalArgumentException("No VisitorsFactory is registered for SourceType [" + sourceType + "].");
42 |  | } else {
43 | 1055 | return handler;
44 |  | }
45 |  | }
46 |  |
47 |  | }