langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
changeset 5855 00d9c252e60c
parent 5520 86e4b9a9da40
child 7614 cfadc977ca75
equal deleted inserted replaced
5854:5dc61238219e 5855:00d9c252e60c
    26 package com.sun.tools.doclets.internal.toolkit.builders;
    26 package com.sun.tools.doclets.internal.toolkit.builders;
    27 
    27 
    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.lang.reflect.*;
       
    32 import java.util.*;
    31 import java.util.*;
    33 
    32 
    34 /**
    33 /**
    35  * Builds documentation for a constructor.
    34  * Builds documentation for a constructor.
    36  *
    35  *
   132         public boolean hasMembersToDocument() {
   131         public boolean hasMembersToDocument() {
   133                 return constructors.size() > 0;
   132                 return constructors.size() > 0;
   134         }
   133         }
   135 
   134 
   136         /**
   135         /**
   137          * {@inheritDoc}
       
   138          */
       
   139         public void invokeMethod(
       
   140                 String methodName,
       
   141                 Class<?>[] paramClasses,
       
   142                 Object[] params)
       
   143                 throws Exception {
       
   144                 if (DEBUG) {
       
   145                         configuration.root.printError(
       
   146                                 "DEBUG: " + this.getClass().getName() + "." + methodName);
       
   147                 }
       
   148                 Method method = this.getClass().getMethod(methodName, paramClasses);
       
   149                 method.invoke(this, params);
       
   150         }
       
   151 
       
   152         /**
       
   153          * Returns a list of constructors that will be documented for the given class.
   136          * Returns a list of constructors that will be documented for the given class.
   154          * This information can be used for doclet specific documentation
   137          * This information can be used for doclet specific documentation
   155          * generation.
   138          * generation.
   156          *
   139          *
   157          * @return a list of constructors that will be documented.
   140          * @return a list of constructors that will be documented.
   173          * Build the constructor documentation.
   156          * Build the constructor documentation.
   174          *
   157          *
   175          * @param elements the XML elements that specify how to construct this
   158          * @param elements the XML elements that specify how to construct this
   176          *                documentation.
   159          *                documentation.
   177          */
   160          */
   178         public void buildConstructorDoc(List<?> elements) {
   161         public void buildConstructorDoc(XMLNode node) {
   179                 if (writer == null) {
   162                 if (writer == null) {
   180                         return;
   163                         return;
   181                 }
   164                 }
   182                 for (currentMethodIndex = 0;
   165                 for (currentMethodIndex = 0;
   183                         currentMethodIndex < constructors.size();
   166                         currentMethodIndex < constructors.size();
   184                         currentMethodIndex++) {
   167                         currentMethodIndex++) {
   185                         build(elements);
   168                         buildChildren(node);
   186                 }
   169                 }
   187         }
   170         }
   188 
   171 
   189         /**
   172         /**
   190          * Build the overall header.
   173          * Build the overall header.
   191          */
   174          */
   192         public void buildHeader() {
   175         public void buildHeader(XMLNode node) {
   193                 writer.writeHeader(
   176                 writer.writeHeader(
   194                         classDoc,
   177                         classDoc,
   195                         configuration.getText("doclet.Constructor_Detail"));
   178                         configuration.getText("doclet.Constructor_Detail"));
   196         }
   179         }
   197 
   180 
   198         /**
   181         /**
   199          * Build the header for the individual constructor.
   182          * Build the header for the individual constructor.
   200          */
   183          */
   201         public void buildConstructorHeader() {
   184         public void buildConstructorHeader(XMLNode node) {
   202                 writer.writeConstructorHeader(
   185                 writer.writeConstructorHeader(
   203                         (ConstructorDoc) constructors.get(currentMethodIndex),
   186                         (ConstructorDoc) constructors.get(currentMethodIndex),
   204                         currentMethodIndex == 0);
   187                         currentMethodIndex == 0);
   205         }
   188         }
   206 
   189 
   207         /**
   190         /**
   208          * Build the signature.
   191          * Build the signature.
   209          */
   192          */
   210         public void buildSignature() {
   193         public void buildSignature(XMLNode node) {
   211                 writer.writeSignature(
   194                 writer.writeSignature(
   212                         (ConstructorDoc) constructors.get(currentMethodIndex));
   195                         (ConstructorDoc) constructors.get(currentMethodIndex));
   213         }
   196         }
   214 
   197 
   215         /**
   198         /**
   216          * Build the deprecation information.
   199          * Build the deprecation information.
   217          */
   200          */
   218         public void buildDeprecationInfo() {
   201         public void buildDeprecationInfo(XMLNode node) {
   219                 writer.writeDeprecated(
   202                 writer.writeDeprecated(
   220                         (ConstructorDoc) constructors.get(currentMethodIndex));
   203                         (ConstructorDoc) constructors.get(currentMethodIndex));
   221         }
   204         }
   222 
   205 
   223         /**
   206         /**
   224          * Build the comments for the constructor.  Do nothing if
   207          * Build the comments for the constructor.  Do nothing if
   225          * {@link Configuration#nocomment} is set to true.
   208          * {@link Configuration#nocomment} is set to true.
   226          */
   209          */
   227         public void buildConstructorComments() {
   210         public void buildConstructorComments(XMLNode node) {
   228                 if (!configuration.nocomment) {
   211                 if (!configuration.nocomment) {
   229                         writer.writeComments(
   212                         writer.writeComments(
   230                                 (ConstructorDoc) constructors.get(currentMethodIndex));
   213                                 (ConstructorDoc) constructors.get(currentMethodIndex));
   231                 }
   214                 }
   232         }
   215         }
   233 
   216 
   234         /**
   217         /**
   235          * Build the tag information.
   218          * Build the tag information.
   236          */
   219          */
   237         public void buildTagInfo() {
   220         public void buildTagInfo(XMLNode node) {
   238                 writer.writeTags((ConstructorDoc) constructors.get(currentMethodIndex));
   221                 writer.writeTags((ConstructorDoc) constructors.get(currentMethodIndex));
   239         }
   222         }
   240 
   223 
   241         /**
   224         /**
   242          * Build the footer for the individual constructor.
   225          * Build the footer for the individual constructor.
   243          */
   226          */
   244         public void buildConstructorFooter() {
   227         public void buildConstructorFooter(XMLNode node) {
   245                 writer.writeConstructorFooter();
   228                 writer.writeConstructorFooter();
   246         }
   229         }
   247 
   230 
   248         /**
   231         /**
   249          * Build the overall footer.
   232          * Build the overall footer.
   250          */
   233          */
   251         public void buildFooter() {
   234         public void buildFooter(XMLNode node) {
   252                 writer.writeFooter(classDoc);
   235                 writer.writeFooter(classDoc);
   253         }
   236         }
   254 }
   237 }