OSDN Git Service

libjava/ChangeLog:
[pf3gnuchains/gcc-fork.git] / libjava / classpath / tools / gnu / classpath / tools / gjdoc / ClassDocProxy.java
1 /* gnu.classpath.tools.gjdoc.ClassDocProxy
2    Copyright (C) 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10  
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
20
21 package gnu.classpath.tools.gjdoc;
22
23 import com.sun.javadoc.*;
24
25 import java.io.*;
26
27 public class ClassDocProxy implements ClassDoc, WritableType {
28
29    private String name;
30    private String qualifiedName;
31    private ClassDoc classContext;
32    private String dimension = "";
33
34    public ClassDocProxy(String qualifiedName, ClassDoc classContext) 
35    {
36       this.qualifiedName
37          = Main.getRootDoc().resolveClassName(qualifiedName, 
38                                               (ClassDocImpl)classContext);
39       this.classContext=classContext;
40       int pndx=qualifiedName.lastIndexOf('.');
41       if (pndx>=0) {
42          this.name=qualifiedName.substring(pndx+1);
43       }
44       else {
45          this.name=qualifiedName;
46       }
47    }
48
49    private final String errorText() 
50    {
51       return "CLASS "+qualifiedName+" NOT LOADED.";
52    }
53
54    public ConstructorDoc[] constructors() { return new ConstructorDoc[0]; } 
55    public ConstructorDoc[] constructors(boolean filtered) { return new ConstructorDoc[0]; }
56    public boolean definesSerializableFields() { return false; } 
57    public FieldDoc[] fields() { return new FieldDoc[0]; } 
58    public FieldDoc[] fields(boolean filtered) { return new FieldDoc[0]; } 
59    public ClassDoc findClass(java.lang.String className) { return null; } 
60    public ClassDoc[] importedClasses() { return new ClassDoc[0]; } 
61    public PackageDoc[] importedPackages() { return new PackageDoc[0]; } 
62    public ClassDoc[] innerClasses() { return new ClassDoc[0]; } 
63    public ClassDoc[] innerClasses(boolean filtered) { return new ClassDoc[0]; } 
64    public ClassDoc[] interfaces() { return new ClassDoc[0]; } 
65    public boolean isAbstract() { return false; } 
66    public boolean isExternalizable() { return false; } 
67    public boolean isSerializable() { return false; } 
68    public MethodDoc[] methods() { return new MethodDoc[0]; } 
69    public MethodDoc[] methods(boolean filtered) { return new MethodDoc[0]; } 
70    public FieldDoc[] serializableFields() { return new FieldDoc[0]; } 
71    public MethodDoc[] serializationMethods() { return new MethodDoc[0]; } 
72    public boolean subclassOf(ClassDoc cd) { return false; } 
73    public ClassDoc superclass() { return null; } 
74    public ClassDoc containingClass() { return null; } 
75    public PackageDoc containingPackage() { 
76       /*
77       try {
78          File file=Main.getRootDoc().findScheduledClass(qualifiedName, classContext);
79          if (file!=null) {
80             //String clsName=file.getCanonicalFile().getAbsolutePath().substring(new File(Main.getRootDoc().getSourcePath()).getCanonicalFile().getAbsolutePath().length()+1);
81             String clsName=file.getAbsolutePath().substring(new File(Main.getRootDoc().getSourcePath()).getAbsolutePath().length()+1);
82             clsName=clsName.substring(0,clsName.length()-5).replace(File.separatorChar,'.');
83             Debug.log(9,"ClassDocProxy '"+qualifiedName+"': found class "+clsName);
84             qualifiedName=clsName;
85          }
86          return new PackageDocImpl("test.");
87       }
88       catch (Exception e) {
89          return PackageDocImpl.DEFAULT_PACKAGE; 
90       }
91       */
92       return PackageDocImpl.DEFAULT_PACKAGE;
93    } 
94
95    public boolean isFinal() { return false; } 
96    public boolean isPackagePrivate() { return false; } 
97    public boolean isPrivate() { return false; } 
98    public boolean isProtected() { return false; } 
99    public boolean isPublic() { return false; } 
100    public boolean isStatic() { return false; } 
101    public String modifiers() { return ""; } 
102    public int modifierSpecifier() { return 0; } 
103    public String qualifiedName() { return qualifiedName; } 
104    public String commentText() { return null; } 
105    public Tag[] firstSentenceTags() { return new Tag[0]; } 
106    public String getRawCommentText() { return null; } 
107    public Tag[] inlineTags() { return new Tag[0]; } 
108    public boolean isClass() { return false; } 
109    public boolean isConstructor() { return false; } 
110    public boolean isError() { return false; } 
111    public boolean isException() { return false; } 
112    public boolean isField() { return false; } 
113    public boolean isIncluded() { return false; } 
114    public boolean isInterface() { return false; } 
115    public boolean isMethod() { return false; } 
116    public boolean isOrdinaryClass() { return false; } 
117    public String name() { return name; } 
118    public SourcePosition position() { return null; }
119    public SeeTag[] seeTags() { return new SeeTag[0]; } 
120    public void setRawCommentText(java.lang.String rawDocumentation) {} 
121    public Tag[] tags() { return new Tag[0]; } 
122    public Tag[] tags(java.lang.String tagname) { return new Tag[0]; }
123    public String typeName() { return name; }
124    public String qualifiedTypeName() { return qualifiedName; }
125    public String dimension() { return dimension; }
126    public ClassDoc asClassDoc() { return this; }
127    public TypeVariable asTypeVariable() { return null; }
128    public boolean isPrimitive() { return false; }
129
130    public String toString() { return "ClassDocProxy{"+qualifiedName+", context="+classContext+"}"; }
131
132    public void setDimension(String dimension) {
133       this.dimension = dimension;
134    }
135
136    public Object clone() throws CloneNotSupportedException {
137       return super.clone();
138    }
139
140    // Compares this Object with the specified Object for order. 
141    public int compareTo(java.lang.Object o) {
142       if (o instanceof Doc) {
143          return Main.getInstance().getCollator().compare(name(), ((Doc)o).name());
144       }
145       else {
146          return 0;
147       }
148    }
149
150    public TypeVariable[] typeParameters() { return new TypeVariable[0]; } 
151
152 }