Import GNU Classpath (20121202).
[official-gcc.git] / libjava / classpath / tools / gnu / classpath / tools / gjdoc / ClassDocProxy.java
blobaa06addf7fabbe7a603cac59947d04d40182b5a7
1 /* gnu.classpath.tools.gjdoc.ClassDocProxy
2 Copyright (C) 2001, 2012 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package gnu.classpath.tools.gjdoc;
40 import com.sun.javadoc.*;
42 import java.io.*;
44 public class ClassDocProxy implements ClassDoc, WritableType {
46 private String name;
47 private String qualifiedName;
48 private ClassDoc classContext;
49 private String dimension = "";
51 public ClassDocProxy(String qualifiedName, ClassDoc classContext)
53 this.qualifiedName
54 = Main.getRootDoc().resolveClassName(qualifiedName,
55 (ClassDocImpl)classContext);
56 this.classContext=classContext;
57 int pndx=qualifiedName.lastIndexOf('.');
58 if (pndx>=0) {
59 this.name=qualifiedName.substring(pndx+1);
61 else {
62 this.name=qualifiedName;
66 private final String errorText()
68 return "CLASS "+qualifiedName+" NOT LOADED.";
71 public ConstructorDoc[] constructors() { return new ConstructorDoc[0]; }
72 public ConstructorDoc[] constructors(boolean filtered) { return new ConstructorDoc[0]; }
73 public boolean definesSerializableFields() { return false; }
74 public FieldDoc[] fields() { return new FieldDoc[0]; }
75 public FieldDoc[] fields(boolean filtered) { return new FieldDoc[0]; }
76 public ClassDoc findClass(java.lang.String className) { return null; }
77 public ClassDoc[] importedClasses() { return new ClassDoc[0]; }
78 public PackageDoc[] importedPackages() { return new PackageDoc[0]; }
79 public ClassDoc[] innerClasses() { return new ClassDoc[0]; }
80 public ClassDoc[] innerClasses(boolean filtered) { return new ClassDoc[0]; }
81 public ClassDoc[] interfaces() { return new ClassDoc[0]; }
82 public boolean isAbstract() { return false; }
83 public boolean isExternalizable() { return false; }
84 public boolean isSerializable() { return false; }
85 public MethodDoc[] methods() { return new MethodDoc[0]; }
86 public MethodDoc[] methods(boolean filtered) { return new MethodDoc[0]; }
87 public FieldDoc[] serializableFields() { return new FieldDoc[0]; }
88 public MethodDoc[] serializationMethods() { return new MethodDoc[0]; }
89 public boolean subclassOf(ClassDoc cd) { return false; }
90 public ClassDoc superclass() { return null; }
91 public ClassDoc containingClass() { return null; }
92 public PackageDoc containingPackage() {
94 try {
95 File file=Main.getRootDoc().findScheduledClass(qualifiedName, classContext);
96 if (file!=null) {
97 //String clsName=file.getCanonicalFile().getAbsolutePath().substring(new File(Main.getRootDoc().getSourcePath()).getCanonicalFile().getAbsolutePath().length()+1);
98 String clsName=file.getAbsolutePath().substring(new File(Main.getRootDoc().getSourcePath()).getAbsolutePath().length()+1);
99 clsName=clsName.substring(0,clsName.length()-5).replace(File.separatorChar,'.');
100 Debug.log(9,"ClassDocProxy '"+qualifiedName+"': found class "+clsName);
101 qualifiedName=clsName;
103 return new PackageDocImpl("test.");
105 catch (Exception e) {
106 return PackageDocImpl.DEFAULT_PACKAGE;
109 return PackageDocImpl.DEFAULT_PACKAGE;
112 public boolean isFinal() { return false; }
113 public boolean isPackagePrivate() { return false; }
114 public boolean isPrivate() { return false; }
115 public boolean isProtected() { return false; }
116 public boolean isPublic() { return false; }
117 public boolean isStatic() { return false; }
118 public String modifiers() { return ""; }
119 public int modifierSpecifier() { return 0; }
120 public String qualifiedName() { return qualifiedName; }
121 public String commentText() { return null; }
122 public Tag[] firstSentenceTags() { return new Tag[0]; }
123 public String getRawCommentText() { return null; }
124 public Tag[] inlineTags() { return new Tag[0]; }
125 public boolean isClass() { return false; }
126 public boolean isConstructor() { return false; }
127 public boolean isError() { return false; }
128 public boolean isException() { return false; }
129 public boolean isField() { return false; }
130 public boolean isIncluded() { return false; }
131 public boolean isInterface() { return false; }
132 public boolean isMethod() { return false; }
133 public boolean isOrdinaryClass() { return false; }
134 public String name() { return name; }
135 public SourcePosition position() { return null; }
136 public SeeTag[] seeTags() { return new SeeTag[0]; }
137 public void setRawCommentText(java.lang.String rawDocumentation) {}
138 public Tag[] tags() { return new Tag[0]; }
139 public Tag[] tags(java.lang.String tagname) { return new Tag[0]; }
140 public String typeName() { return name; }
141 public String qualifiedTypeName() { return qualifiedName; }
142 public String dimension() { return dimension; }
143 public ClassDoc asClassDoc() { return this; }
144 public TypeVariable asTypeVariable() { return null; }
145 public boolean isPrimitive() { return false; }
147 public String toString() { return "ClassDocProxy{"+qualifiedName+", context="+classContext+"}"; }
149 public void setDimension(String dimension) {
150 this.dimension = dimension;
153 public Object clone() throws CloneNotSupportedException {
154 return super.clone();
157 // Compares this Object with the specified Object for order.
158 public int compareTo(Doc d) {
159 return Main.getInstance().getCollator().compare(name(), d.name());
162 public TypeVariable[] typeParameters() { return new TypeVariable[0]; }