1 /* gnu.classpath.tools.gjdoc.ClassDocProxy 2 Copyright (C) 2001, 2012 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 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. 25 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. */ 37 38 package gnu.classpath.tools.gjdoc; 39 40 import com.sun.javadoc.*; 41 42 import java.io.*; 43 44 public class ClassDocProxy implements ClassDoc, WritableType { 45 46 private String name; 47 private String qualifiedName; 48 private ClassDoc classContext; 49 private String dimension = ""; 50 ClassDocProxy(String qualifiedName, ClassDoc classContext)51 public ClassDocProxy(String qualifiedName, ClassDoc classContext) 52 { 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); 60 } 61 else { 62 this.name=qualifiedName; 63 } 64 } 65 errorText()66 private final String errorText() 67 { 68 return "CLASS "+qualifiedName+" NOT LOADED."; 69 } 70 constructors()71 public ConstructorDoc[] constructors() { return new ConstructorDoc[0]; } constructors(boolean filtered)72 public ConstructorDoc[] constructors(boolean filtered) { return new ConstructorDoc[0]; } definesSerializableFields()73 public boolean definesSerializableFields() { return false; } fields()74 public FieldDoc[] fields() { return new FieldDoc[0]; } fields(boolean filtered)75 public FieldDoc[] fields(boolean filtered) { return new FieldDoc[0]; } findClass(java.lang.String className)76 public ClassDoc findClass(java.lang.String className) { return null; } importedClasses()77 public ClassDoc[] importedClasses() { return new ClassDoc[0]; } importedPackages()78 public PackageDoc[] importedPackages() { return new PackageDoc[0]; } innerClasses()79 public ClassDoc[] innerClasses() { return new ClassDoc[0]; } innerClasses(boolean filtered)80 public ClassDoc[] innerClasses(boolean filtered) { return new ClassDoc[0]; } interfaces()81 public ClassDoc[] interfaces() { return new ClassDoc[0]; } isAbstract()82 public boolean isAbstract() { return false; } isExternalizable()83 public boolean isExternalizable() { return false; } isSerializable()84 public boolean isSerializable() { return false; } methods()85 public MethodDoc[] methods() { return new MethodDoc[0]; } methods(boolean filtered)86 public MethodDoc[] methods(boolean filtered) { return new MethodDoc[0]; } serializableFields()87 public FieldDoc[] serializableFields() { return new FieldDoc[0]; } serializationMethods()88 public MethodDoc[] serializationMethods() { return new MethodDoc[0]; } subclassOf(ClassDoc cd)89 public boolean subclassOf(ClassDoc cd) { return false; } superclass()90 public ClassDoc superclass() { return null; } containingClass()91 public ClassDoc containingClass() { return null; } containingPackage()92 public PackageDoc containingPackage() { 93 /* 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; 102 } 103 return new PackageDocImpl("test."); 104 } 105 catch (Exception e) { 106 return PackageDocImpl.DEFAULT_PACKAGE; 107 } 108 */ 109 return PackageDocImpl.DEFAULT_PACKAGE; 110 } 111 isFinal()112 public boolean isFinal() { return false; } isPackagePrivate()113 public boolean isPackagePrivate() { return false; } isPrivate()114 public boolean isPrivate() { return false; } isProtected()115 public boolean isProtected() { return false; } isPublic()116 public boolean isPublic() { return false; } isStatic()117 public boolean isStatic() { return false; } modifiers()118 public String modifiers() { return ""; } modifierSpecifier()119 public int modifierSpecifier() { return 0; } qualifiedName()120 public String qualifiedName() { return qualifiedName; } commentText()121 public String commentText() { return null; } firstSentenceTags()122 public Tag[] firstSentenceTags() { return new Tag[0]; } getRawCommentText()123 public String getRawCommentText() { return null; } inlineTags()124 public Tag[] inlineTags() { return new Tag[0]; } isClass()125 public boolean isClass() { return false; } isConstructor()126 public boolean isConstructor() { return false; } isError()127 public boolean isError() { return false; } isException()128 public boolean isException() { return false; } isField()129 public boolean isField() { return false; } isIncluded()130 public boolean isIncluded() { return false; } isInterface()131 public boolean isInterface() { return false; } isMethod()132 public boolean isMethod() { return false; } isOrdinaryClass()133 public boolean isOrdinaryClass() { return false; } name()134 public String name() { return name; } position()135 public SourcePosition position() { return null; } seeTags()136 public SeeTag[] seeTags() { return new SeeTag[0]; } setRawCommentText(java.lang.String rawDocumentation)137 public void setRawCommentText(java.lang.String rawDocumentation) {} tags()138 public Tag[] tags() { return new Tag[0]; } tags(java.lang.String tagname)139 public Tag[] tags(java.lang.String tagname) { return new Tag[0]; } typeName()140 public String typeName() { return name; } qualifiedTypeName()141 public String qualifiedTypeName() { return qualifiedName; } dimension()142 public String dimension() { return dimension; } asClassDoc()143 public ClassDoc asClassDoc() { return this; } asTypeVariable()144 public TypeVariable asTypeVariable() { return null; } isPrimitive()145 public boolean isPrimitive() { return false; } 146 toString()147 public String toString() { return "ClassDocProxy{"+qualifiedName+", context="+classContext+"}"; } 148 setDimension(String dimension)149 public void setDimension(String dimension) { 150 this.dimension = dimension; 151 } 152 clone()153 public Object clone() throws CloneNotSupportedException { 154 return super.clone(); 155 } 156 157 // Compares this Object with the specified Object for order. compareTo(Doc d)158 public int compareTo(Doc d) { 159 return Main.getInstance().getCollator().compare(name(), d.name()); 160 } 161 typeParameters()162 public TypeVariable[] typeParameters() { return new TypeVariable[0]; } 163 164 } 165