Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PicoContainerFactory |
|
| 1.0;1 |
1 | package com.liquidatom.derbyscore; | |
2 | ||
3 | import org.picocontainer.DefaultPicoContainer; | |
4 | import org.picocontainer.MutablePicoContainer; | |
5 | import org.picocontainer.behaviors.OptInCaching; | |
6 | ||
7 | /** | |
8 | * A utility for accessing the global pico-container for the application. | |
9 | * | |
10 | * | |
11 | * @author Russell Francis (russ@metro-six.com) | |
12 | */ | |
13 | public class PicoContainerFactory { | |
14 | ||
15 | 1 | static private final PicoContainerFactory instance = new PicoContainerFactory(); |
16 | ||
17 | /** | |
18 | * Get a reference to the current PicoContainerFactory instance. | |
19 | * | |
20 | * @return A non-null reference to the PicoContainerFactory instance. | |
21 | */ | |
22 | public static PicoContainerFactory getInstance() { | |
23 | 1 | return instance; |
24 | } | |
25 | ||
26 | 1 | private MutablePicoContainer pico = new DefaultPicoContainer(new OptInCaching()); |
27 | ||
28 | /** | |
29 | * Private constructor to prevent instantiation. | |
30 | */ | |
31 | 1 | private PicoContainerFactory() { |
32 | 1 | } |
33 | ||
34 | /** | |
35 | * A utility for accessing the global pico-container for the application. | |
36 | * | |
37 | * @return A non-null reference which can be used to get instances of particular classes and interfaces in disparate | |
38 | * locations within the application. | |
39 | */ | |
40 | public MutablePicoContainer get() { | |
41 | 1 | return pico; |
42 | } | |
43 | } |