langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
changeset 5855 00d9c252e60c
parent 5520 86e4b9a9da40
child 7614 cfadc977ca75
equal deleted inserted replaced
5854:5dc61238219e 5855:00d9c252e60c
    28 import com.sun.tools.doclets.internal.toolkit.util.*;
    28 import com.sun.tools.doclets.internal.toolkit.util.*;
    29 import com.sun.tools.doclets.internal.toolkit.*;
    29 import com.sun.tools.doclets.internal.toolkit.*;
    30 import com.sun.javadoc.*;
    30 import com.sun.javadoc.*;
    31 import java.io.*;
    31 import java.io.*;
    32 import java.util.*;
    32 import java.util.*;
    33 import java.lang.reflect.*;
       
    34 
    33 
    35 /**
    34 /**
    36  * Builds the summary for a given class.
    35  * Builds the summary for a given class.
    37  *
    36  *
    38  * This code is not part of an API.
    37  * This code is not part of an API.
   106     }
   105     }
   107 
   106 
   108     /**
   107     /**
   109      * {@inheritDoc}
   108      * {@inheritDoc}
   110      */
   109      */
   111     public void invokeMethod(String methodName, Class<?>[] paramClasses,
       
   112             Object[] params)
       
   113     throws Exception {
       
   114         if (DEBUG) {
       
   115             configuration.root.printError("DEBUG: " + this.getClass().getName()
       
   116                 + "." + methodName);
       
   117         }
       
   118         Method method = this.getClass().getMethod(methodName, paramClasses);
       
   119         method.invoke(this, params);
       
   120     }
       
   121 
       
   122     /**
       
   123      * {@inheritDoc}
       
   124      */
       
   125     public void build() throws IOException {
   110     public void build() throws IOException {
   126         build(LayoutParser.getInstance(configuration).parseXML(ROOT));
   111         build(LayoutParser.getInstance(configuration).parseXML(ROOT));
   127     }
   112     }
   128 
   113 
   129     /**
   114     /**
   136      /**
   121      /**
   137       * Handles the &lt;ClassDoc> tag.
   122       * Handles the &lt;ClassDoc> tag.
   138       *
   123       *
   139       * @param elements the XML elements that specify how to document a class.
   124       * @param elements the XML elements that specify how to document a class.
   140       */
   125       */
   141      public void buildClassDoc(List<?> elements) throws Exception {
   126      public void buildClassDoc(XMLNode node) throws Exception {
   142         build(elements);
   127         buildChildren(node);
   143         writer.close();
   128         writer.close();
   144         copyDocFiles();
   129         copyDocFiles();
   145      }
   130      }
   146 
   131 
   147 
   132 
   167      }
   152      }
   168 
   153 
   169     /**
   154     /**
   170      * Build the header of the page.
   155      * Build the header of the page.
   171      */
   156      */
   172     public void buildClassHeader() {
   157     public void buildClassHeader(XMLNode node) {
   173         String key;
   158         String key;
   174         if (isInterface) {
   159         if (isInterface) {
   175             key =  "doclet.Interface";
   160             key =  "doclet.Interface";
   176         } else if (isEnum) {
   161         } else if (isEnum) {
   177             key = "doclet.Enum";
   162             key = "doclet.Enum";
   183     }
   168     }
   184 
   169 
   185     /**
   170     /**
   186      * Build the class tree documentation.
   171      * Build the class tree documentation.
   187      */
   172      */
   188     public void buildClassTree() {
   173     public void buildClassTree(XMLNode node) {
   189         writer.writeClassTree();
   174         writer.writeClassTree();
   190     }
   175     }
   191 
   176 
   192     /**
   177     /**
   193      * If this is a class, list all interfaces
   178      * If this is a class, list all interfaces
   194      * implemented by this class.
   179      * implemented by this class.
   195      */
   180      */
   196     public void buildImplementedInterfacesInfo() {
   181     public void buildImplementedInterfacesInfo(XMLNode node) {
   197         writer.writeImplementedInterfacesInfo();
   182         writer.writeImplementedInterfacesInfo();
   198     }
   183     }
   199 
   184 
   200     /**
   185     /**
   201      * If this is an interface, list all super interfaces.
   186      * If this is an interface, list all super interfaces.
   202      */
   187      */
   203     public void buildSuperInterfacesInfo() {
   188     public void buildSuperInterfacesInfo(XMLNode node) {
   204         writer.writeSuperInterfacesInfo();
   189         writer.writeSuperInterfacesInfo();
   205     }
   190     }
   206 
   191 
   207     /**
   192     /**
   208      * List the parameters of this class.
   193      * List the parameters of this class.
   209      */
   194      */
   210     public void buildTypeParamInfo() {
   195     public void buildTypeParamInfo(XMLNode node) {
   211         writer.writeTypeParamInfo();
   196         writer.writeTypeParamInfo();
   212     }
   197     }
   213 
   198 
   214     /**
   199     /**
   215      * List all the classes extend this one.
   200      * List all the classes extend this one.
   216      */
   201      */
   217     public void buildSubClassInfo() {
   202     public void buildSubClassInfo(XMLNode node) {
   218         writer.writeSubClassInfo();
   203         writer.writeSubClassInfo();
   219     }
   204     }
   220 
   205 
   221     /**
   206     /**
   222      * List all the interfaces that extend this one.
   207      * List all the interfaces that extend this one.
   223      */
   208      */
   224     public void buildSubInterfacesInfo() {
   209     public void buildSubInterfacesInfo(XMLNode node) {
   225         writer.writeSubInterfacesInfo();
   210         writer.writeSubInterfacesInfo();
   226     }
   211     }
   227 
   212 
   228     /**
   213     /**
   229      * If this is an interface, list all classes that implement this interface.
   214      * If this is an interface, list all classes that implement this interface.
   230      */
   215      */
   231     public void buildInterfaceUsageInfo () {
   216     public void buildInterfaceUsageInfo (XMLNode node) {
   232         writer.writeInterfaceUsageInfo();
   217         writer.writeInterfaceUsageInfo();
   233     }
   218     }
   234 
   219 
   235     /**
   220     /**
   236      * If this is an inner class or interface, list the enclosing class or
   221      * If this is an inner class or interface, list the enclosing class or
   237      * interface.
   222      * interface.
   238      */
   223      */
   239     public void buildNestedClassInfo () {
   224     public void buildNestedClassInfo (XMLNode node) {
   240         writer.writeNestedClassInfo();
   225         writer.writeNestedClassInfo();
   241     }
   226     }
   242 
   227 
   243     /**
   228     /**
   244      * If this class is deprecated, print the appropriate information.
   229      * If this class is deprecated, print the appropriate information.
   245      */
   230      */
   246     public void buildDeprecationInfo () {
   231     public void buildDeprecationInfo (XMLNode node) {
   247         writer.writeClassDeprecationInfo();
   232         writer.writeClassDeprecationInfo();
   248     }
   233     }
   249 
   234 
   250     /**
   235     /**
   251      * Build the signature of the current class.
   236      * Build the signature of the current class.
   252      */
   237      */
   253     public void buildClassSignature() {
   238     public void buildClassSignature(XMLNode node) {
   254         StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
   239         StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
   255         if (isEnum) {
   240         if (isEnum) {
   256             modifiers.append("enum ");
   241             modifiers.append("enum ");
   257             int index;
   242             int index;
   258             if ((index = modifiers.indexOf("abstract")) >= 0) {
   243             if ((index = modifiers.indexOf("abstract")) >= 0) {
   274     }
   259     }
   275 
   260 
   276     /**
   261     /**
   277      * Build the class description.
   262      * Build the class description.
   278      */
   263      */
   279     public void buildClassDescription() {
   264     public void buildClassDescription(XMLNode node) {
   280        writer.writeClassDescription();
   265        writer.writeClassDescription();
   281     }
   266     }
   282 
   267 
   283     /**
   268     /**
   284      * Build the tag information for the current class.
   269      * Build the tag information for the current class.
   285      */
   270      */
   286     public void buildClassTagInfo() {
   271     public void buildClassTagInfo(XMLNode node) {
   287        writer.writeClassTagInfo();
   272        writer.writeClassTagInfo();
   288     }
   273     }
   289 
   274 
   290     /**
   275     /**
   291      * Build the contents of the page.
   276      * Build the contents of the page.
   292      *
   277      *
   293      * @param elements the XML elements that specify how a member summary is
   278      * @param elements the XML elements that specify how a member summary is
   294      *                 documented.
   279      *                 documented.
   295      */
   280      */
   296     public void buildMemberSummary(List<?> elements) throws Exception {
   281     public void buildMemberSummary(XMLNode node) throws Exception {
   297         configuration.getBuilderFactory().
   282         configuration.getBuilderFactory().
   298             getMemberSummaryBuilder(writer).build(elements);
   283             getMemberSummaryBuilder(writer).buildChildren(node);
   299         writer.completeMemberSummaryBuild();
   284         writer.completeMemberSummaryBuild();
   300     }
   285     }
   301 
   286 
   302     /**
   287     /**
   303      * Build the enum constants documentation.
   288      * Build the enum constants documentation.
   304      *
   289      *
   305      * @param elements the XML elements that specify how a enum constants are
   290      * @param elements the XML elements that specify how a enum constants are
   306      *                 documented.
   291      *                 documented.
   307      */
   292      */
   308     public void buildEnumConstantsDetails(List<?> elements) throws Exception {
   293     public void buildEnumConstantsDetails(XMLNode node) throws Exception {
   309         configuration.getBuilderFactory().
   294         configuration.getBuilderFactory().
   310             getEnumConstantsBuilder(writer).build(elements);
   295             getEnumConstantsBuilder(writer).buildChildren(node);
   311     }
   296     }
   312 
   297 
   313     /**
   298     /**
   314      * Build the field documentation.
   299      * Build the field documentation.
   315      *
   300      *
   316      * @param elements the XML elements that specify how a field is documented.
   301      * @param elements the XML elements that specify how a field is documented.
   317      */
   302      */
   318     public void buildFieldDetails(List<?> elements) throws Exception {
   303     public void buildFieldDetails(XMLNode node) throws Exception {
   319         configuration.getBuilderFactory().
   304         configuration.getBuilderFactory().
   320             getFieldBuilder(writer).build(elements);
   305             getFieldBuilder(writer).buildChildren(node);
   321     }
   306     }
   322 
   307 
   323     /**
   308     /**
   324      * Build the constructor documentation.
   309      * Build the constructor documentation.
   325      *
   310      *
   326      * @param elements the XML elements that specify how to document a
   311      * @param elements the XML elements that specify how to document a
   327      * constructor.
   312      * constructor.
   328      */
   313      */
   329     public void buildConstructorDetails(List<?> elements) throws Exception {
   314     public void buildConstructorDetails(XMLNode node) throws Exception {
   330         configuration.getBuilderFactory().
   315         configuration.getBuilderFactory().
   331             getConstructorBuilder(writer).build(elements);
   316             getConstructorBuilder(writer).buildChildren(node);
   332     }
   317     }
   333 
   318 
   334     /**
   319     /**
   335      * Build the method documentation.
   320      * Build the method documentation.
   336      *
   321      *
   337      * @param elements the XML elements that specify how a method is documented.
   322      * @param elements the XML elements that specify how a method is documented.
   338      */
   323      */
   339     public void buildMethodDetails(List<?> elements) throws Exception {
   324     public void buildMethodDetails(XMLNode node) throws Exception {
   340         configuration.getBuilderFactory().
   325         configuration.getBuilderFactory().
   341                 getMethodBuilder(writer).build(elements);
   326                 getMethodBuilder(writer).buildChildren(node);
   342     }
   327     }
   343 
   328 
   344     /**
   329     /**
   345      * Build the footer of the page.
   330      * Build the footer of the page.
   346      */
   331      */
   347     public void buildClassFooter() {
   332     public void buildClassFooter(XMLNode node) {
   348         writer.writeFooter();
   333         writer.writeFooter();
   349     }
   334     }
   350 }
   335 }