KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > xdoclet > typesystem > impl > type > PrimitiveTypeImpl


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.compiler.xdoclet.typesystem.impl.type;
19
20 import org.apache.beehive.netui.compiler.typesystem.type.PrimitiveType;
21
22 import java.util.HashMap JavaDoc;
23
24 import xjavadoc.XClass;
25
26 public class PrimitiveTypeImpl
27         extends TypeInstanceImpl
28         implements PrimitiveType
29 {
30     private static final HashMap JavaDoc PRIMITIVE_TYPES = new HashMap JavaDoc();
31     
32     static
33     {
34         PRIMITIVE_TYPES.put( "boolean", Kind.BOOLEAN );
35         PRIMITIVE_TYPES.put( "byte", Kind.BYTE );
36         PRIMITIVE_TYPES.put( "short", Kind.SHORT );
37         PRIMITIVE_TYPES.put( "int", Kind.INT );
38         PRIMITIVE_TYPES.put( "long", Kind.LONG );
39         PRIMITIVE_TYPES.put( "char", Kind.CHAR );
40         PRIMITIVE_TYPES.put( "float", Kind.FLOAT );
41         PRIMITIVE_TYPES.put( "double", Kind.DOUBLE );
42     }
43     
44     private Kind _kind;
45     
46     public PrimitiveTypeImpl( XClass delegate )
47     {
48         super( delegate );
49         _kind = ( Kind ) PRIMITIVE_TYPES.get( delegate.getName() );
50         assert _kind != null : "unexpected type " + delegate.getName();
51     }
52     
53     public Kind getKind()
54     {
55         return _kind;
56     }
57 }
58
Popular Tags