1 /***
2 * EnumerationConfiguration.java
3 *
4 * This file is part of the creme library.
5 * The creme library intends to ease the development effort of large
6 * applications by providing easy to use support classes.
7 *
8 * Copyright (C) 2002 Denis Bregeon
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library 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 GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * contact information: dbregeon@sourceforge.net
25 */
26 package org.jcreme.enumerations;
27
28 /***
29 * This is a singleton class. It stores an EnumerationInitializer so that it is
30 * accessible from any point in the Virtual Machine.
31 *
32 * @author $Author: dbregeon $
33 * @version $Revision: 1.2 $
34 */
35 public class EnumerationConfiguration {
36 /***
37 * The unique instance of this class.
38 */
39 private static EnumerationConfiguration instance = null;
40
41 /***
42 * The enumeration initializer to be used in the virtual machine.
43 */
44 private EnumerationInitializer enumerationInitializer = null;
45
46 /***
47 * This is the access method for the singleton.
48 *
49 * @return the unique instance of this class.
50 */
51 public synchronized static EnumerationConfiguration getInstance() {
52 if (instance == null) {
53 instance = new EnumerationConfiguration();
54 }
55 return instance;
56 }
57
58 /***
59 * Creates a new instance of StaticDataConfiguration
60 */
61 protected EnumerationConfiguration() {
62
63 }
64
65 /***
66 * This method sets the initializer in this configuration.
67 *
68 * @param initializer
69 * the initializer to use in this configuration. It can be null.
70 */
71 public void setEnumerationInitializer(
72 final EnumerationInitializer initializer) {
73 this.enumerationInitializer = initializer;
74 }
75
76 /***
77 * This method enables access to the EnumerationInitializer.
78 *
79 * @return the initializer to use in this configuration. It can be null.
80 */
81 public EnumerationInitializer getEnumerationInitializer() {
82 return this.enumerationInitializer;
83 }
84 }