KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > alt > jiapi > event > EventRuntime


1 /*
2  * Copyright (C) 2001 Mika Riekkinen, Joni Suominen
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package alt.jiapi.event;
20
21 import java.util.HashMap JavaDoc;
22 import java.util.Map JavaDoc;
23
24
25
26 /**
27  * This class is a class that holds mainly static common methods,
28  * which are used by other Jiapi classes.
29  *
30  * @author Mika Riekkinen
31  * @author Joni Suominen
32  * @version $Revision: 1.1 $ $Date: 2004/03/21 12:52:11 $
33  */

34 public class EventRuntime {
35     private static Map JavaDoc fieldValues = new HashMap JavaDoc();
36     private static int fieldNameIndex = 1;
37
38     public static synchronized void setFieldValue(String JavaDoc fieldName,
39                                                   Object JavaDoc value) {
40         fieldValues.put(fieldName, value);
41     }
42
43     public static synchronized Object JavaDoc getFieldValue(String JavaDoc fieldName) {
44         Object JavaDoc o = fieldValues.get(fieldName);
45         return o;
46     }
47
48     public static synchronized int nextFieldNameIndex() {
49         return fieldNameIndex++;
50     }
51 }
52
Popular Tags