KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > innig > macker > structure > PrimitiveTypeInfo


1 /*______________________________________________________________________________
2  *
3  * Macker http://innig.net/macker/
4  *
5  * Copyright 2002-2003 Paul Cantrell
6  *
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License version 2, as published by the
9  * Free Software Foundation. See the file LICENSE.html for more information.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the license for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
17  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
18  *______________________________________________________________________________
19  */

20  
21 package net.innig.macker.structure;
22
23 import java.util.*;
24 import net.innig.collect.InnigCollections;
25 import net.innig.collect.MultiMap;
26 import net.innig.util.EnumeratedType;
27
28 /**
29     Hard-coded class info for Java's primitive types.
30 */

31 public final class PrimitiveTypeInfo
32     extends EnumeratedType
33     implements ClassInfo
34     {
35     public static PrimitiveTypeInfo getPrimitiveTypeInfo(String JavaDoc typeName)
36         { return (PrimitiveTypeInfo) EnumeratedType.resolveFromName(PrimitiveTypeInfo.class, typeName); }
37     
38     public static final PrimitiveTypeInfo
39         BYTE = new PrimitiveTypeInfo("byte"),
40         SHORT = new PrimitiveTypeInfo("short"),
41         INT = new PrimitiveTypeInfo("int"),
42         LONG = new PrimitiveTypeInfo("long"),
43         CHAR = new PrimitiveTypeInfo("char"),
44         BOOLEAN = new PrimitiveTypeInfo("boolean"),
45         FLOAT = new PrimitiveTypeInfo("float"),
46         DOUBLE = new PrimitiveTypeInfo("double"),
47         VOID = new PrimitiveTypeInfo("void");
48     
49     public static final Set/*<PrimitiveTypeInfo>*/ ALL =
50         EnumeratedType.allTypes(PrimitiveTypeInfo.class);
51
52     private PrimitiveTypeInfo(String JavaDoc className)
53         { super(className); }
54     
55     public ClassManager getClassManager()
56         { return null; }
57     
58     public boolean isComplete()
59         { return true; }
60     
61     public String JavaDoc getFullName() { return getName(); }
62     public String JavaDoc getClassName() { return getName(); }
63     public String JavaDoc getPackageName() { return null; }
64     
65     public boolean isInterface() { return false; }
66     public boolean isAbstract() { return false; }
67     public boolean isFinal() { return true; }
68     public AccessModifier getAccessModifier() { return AccessModifier.PUBLIC; }
69     
70     public ClassInfo getExtends() { return null; }
71     public Set/*<ClassInfo>*/ getImplements() { return Collections.EMPTY_SET; }
72     public Set/*<ClassInfo>*/ getDirectSupertypes() { return Collections.EMPTY_SET; }
73     public Set/*<ClassInfo>*/ getSupertypes() { return Collections.EMPTY_SET; }
74     public MultiMap/*<ClassInfo,Reference>*/ getReferences()
75         { return InnigCollections.EMPTY_MULTIMAP; }
76     
77     public int compareTo(Object JavaDoc that)
78         { return getFullName().compareTo(((ClassInfo) that).getFullName()); }
79     }
80
81
82
Popular Tags