KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webjmx > example > SimpleStandardType


1 /*
2  * SimpleStandardType.java
3  *
4  * Created on December 28, 2001, 11:41 PM
5  */

6
7 package org.webjmx.example;
8
9 import java.util.*;
10
11 /**
12  *
13  * @author john
14  * @version
15  */

16 public class SimpleStandardType extends com.sun.jdmk.Enumerated
17 {
18     private static String JavaDoc strings[] = { "Type 1", "Type2" };
19     private static Map stringMap = new HashMap();
20     private static Map intMap = new HashMap();
21     
22     static
23     {
24         for(int i =0; i < strings.length; i++)
25         {
26             intMap.put(new Integer JavaDoc(i), strings[i]);
27             stringMap.put(strings[i], new Integer JavaDoc(i));
28         }
29     }
30     
31     /** Creates new SimpleStandardType */
32     public SimpleStandardType()
33     { }
34     
35     /** Creates new SimpleStandardType */
36     public SimpleStandardType(String JavaDoc type)
37         throws java.lang.IllegalArgumentException JavaDoc
38     {
39         super(type);
40     }
41
42     protected java.util.Hashtable JavaDoc getIntTable()
43     {
44         return new Hashtable(intMap);
45     }
46     
47     protected java.util.Hashtable JavaDoc getStringTable()
48     {
49         return new Hashtable(stringMap);
50     }
51     
52     public java.util.Enumeration JavaDoc valueIndexes()
53     {
54         return (new Hashtable(intMap)).keys();
55     }
56     
57     public java.util.Enumeration JavaDoc valueStrings()
58     {
59         return (new Hashtable(stringMap)).keys();
60     }
61     
62 }
63
Popular Tags