KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > gumby > tags > types > TypeUtil


1 package org.sapia.gumby.tags.types;
2
3 import java.util.HashMap JavaDoc;
4 import java.util.Map JavaDoc;
5
6 /**
7  * @author Yanick Duchesne
8  *
9  * <dl>
10  * <dt><b>Copyright: </b>
11  * <dd>Copyright &#169; 2002-2005 <a HREF="http://www.sapia-oss.org">Sapia Open
12  * Source Software </a>. All Rights Reserved.</dd>
13  * </dt>
14  * <dt><b>License: </b>
15  * <dd>Read the license.txt file of the jar or visit the <a
16  * HREF="http://www.sapia-oss.org/license.html">license page </a> at the Sapia
17  * OSS web site</dd>
18  * </dt>
19  * </dl>
20  */

21 public class TypeUtil {
22
23   private static Map JavaDoc _types = new HashMap JavaDoc();
24
25   static {
26     _types.put("boolean", boolean.class);
27     _types.put("byte", byte.class);
28     _types.put("char", char.class);
29     _types.put("short", short.class);
30     _types.put("int", int.class);
31     _types.put("float", float.class);
32     _types.put("long", long.class);
33     _types.put("string", String JavaDoc.class);
34   }
35
36   /**
37    * @param name
38    * the name of a type.
39    * @return the <code>Class</code> corresponding to the given type, or
40    * <code>null</code> if class could be found.
41    */

42   public static Class JavaDoc getTypeFor(String JavaDoc name) {
43     return (Class JavaDoc) _types.get(name);
44   }
45
46 }
47
Popular Tags