langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java
changeset 5855 00d9c252e60c
parent 5520 86e4b9a9da40
child 7614 cfadc977ca75
equal deleted inserted replaced
5854:5dc61238219e 5855:00d9c252e60c
    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.util.*;
    31 import java.util.*;
    32 import java.lang.reflect.*;
       
    33 
    32 
    34 /**
    33 /**
    35  * Builds documentation for a field.
    34  * Builds documentation for a field.
    36  *
    35  *
    37  * This code is not part of an API.
    36  * This code is not part of an API.
   115         public String getName() {
   114         public String getName() {
   116                 return "FieldDetails";
   115                 return "FieldDetails";
   117         }
   116         }
   118 
   117 
   119         /**
   118         /**
   120          * {@inheritDoc}
       
   121          */
       
   122         public void invokeMethod(
       
   123                 String methodName,
       
   124                 Class<?>[] paramClasses,
       
   125                 Object[] params)
       
   126                 throws Exception {
       
   127                 if (DEBUG) {
       
   128                         configuration.root.printError(
       
   129                                 "DEBUG: " + this.getClass().getName() + "." + methodName);
       
   130                 }
       
   131                 Method method = this.getClass().getMethod(methodName, paramClasses);
       
   132                 method.invoke(this, params);
       
   133         }
       
   134 
       
   135         /**
       
   136          * Returns a list of fields that will be documented for the given class.
   119          * Returns a list of fields that will be documented for the given class.
   137          * This information can be used for doclet specific documentation
   120          * This information can be used for doclet specific documentation
   138          * generation.
   121          * generation.
   139          *
   122          *
   140          * @param classDoc the {@link ClassDoc} we want to check.
   123          * @param classDoc the {@link ClassDoc} we want to check.
   164          * Build the field documentation.
   147          * Build the field documentation.
   165          *
   148          *
   166          * @param elements the XML elements that specify how to construct this
   149          * @param elements the XML elements that specify how to construct this
   167          *                documentation.
   150          *                documentation.
   168          */
   151          */
   169         public void buildFieldDoc(List<?> elements) {
   152         public void buildFieldDoc(XMLNode node) {
   170                 if (writer == null) {
   153                 if (writer == null) {
   171                         return;
   154                         return;
   172                 }
   155                 }
   173                 for (currentFieldIndex = 0;
   156                 for (currentFieldIndex = 0;
   174                         currentFieldIndex < fields.size();
   157                         currentFieldIndex < fields.size();
   175                         currentFieldIndex++) {
   158                         currentFieldIndex++) {
   176                         build(elements);
   159                         buildChildren(node);
   177                 }
   160                 }
   178         }
   161         }
   179 
   162 
   180         /**
   163         /**
   181          * Build the overall header.
   164          * Build the overall header.
   182          */
   165          */
   183         public void buildHeader() {
   166         public void buildHeader(XMLNode node) {
   184                 writer.writeHeader(
   167                 writer.writeHeader(
   185                         classDoc,
   168                         classDoc,
   186                         configuration.getText("doclet.Field_Detail"));
   169                         configuration.getText("doclet.Field_Detail"));
   187         }
   170         }
   188 
   171 
   189         /**
   172         /**
   190          * Build the header for the individual field.
   173          * Build the header for the individual field.
   191          */
   174          */
   192         public void buildFieldHeader() {
   175         public void buildFieldHeader(XMLNode node) {
   193                 writer.writeFieldHeader(
   176                 writer.writeFieldHeader(
   194                         (FieldDoc) fields.get(currentFieldIndex),
   177                         (FieldDoc) fields.get(currentFieldIndex),
   195                         currentFieldIndex == 0);
   178                         currentFieldIndex == 0);
   196         }
   179         }
   197 
   180 
   198         /**
   181         /**
   199          * Build the signature.
   182          * Build the signature.
   200          */
   183          */
   201         public void buildSignature() {
   184         public void buildSignature(XMLNode node) {
   202                 writer.writeSignature((FieldDoc) fields.get(currentFieldIndex));
   185                 writer.writeSignature((FieldDoc) fields.get(currentFieldIndex));
   203         }
   186         }
   204 
   187 
   205         /**
   188         /**
   206          * Build the deprecation information.
   189          * Build the deprecation information.
   207          */
   190          */
   208         public void buildDeprecationInfo() {
   191         public void buildDeprecationInfo(XMLNode node) {
   209                 writer.writeDeprecated((FieldDoc) fields.get(currentFieldIndex));
   192                 writer.writeDeprecated((FieldDoc) fields.get(currentFieldIndex));
   210         }
   193         }
   211 
   194 
   212         /**
   195         /**
   213          * Build the comments for the field.  Do nothing if
   196          * Build the comments for the field.  Do nothing if
   214          * {@link Configuration#nocomment} is set to true.
   197          * {@link Configuration#nocomment} is set to true.
   215          */
   198          */
   216         public void buildFieldComments() {
   199         public void buildFieldComments(XMLNode node) {
   217                 if (!configuration.nocomment) {
   200                 if (!configuration.nocomment) {
   218                         writer.writeComments((FieldDoc) fields.get(currentFieldIndex));
   201                         writer.writeComments((FieldDoc) fields.get(currentFieldIndex));
   219                 }
   202                 }
   220         }
   203         }
   221 
   204 
   222         /**
   205         /**
   223          * Build the tag information.
   206          * Build the tag information.
   224          */
   207          */
   225         public void buildTagInfo() {
   208         public void buildTagInfo(XMLNode node) {
   226                 writer.writeTags((FieldDoc) fields.get(currentFieldIndex));
   209                 writer.writeTags((FieldDoc) fields.get(currentFieldIndex));
   227         }
   210         }
   228 
   211 
   229         /**
   212         /**
   230          * Build the footer for the individual field.
   213          * Build the footer for the individual field.
   231          */
   214          */
   232         public void buildFieldFooter() {
   215         public void buildFieldFooter(XMLNode node) {
   233                 writer.writeFieldFooter();
   216                 writer.writeFieldFooter();
   234         }
   217         }
   235 
   218 
   236         /**
   219         /**
   237          * Build the overall footer.
   220          * Build the overall footer.
   238          */
   221          */
   239         public void buildFooter() {
   222         public void buildFooter(XMLNode node) {
   240                 writer.writeFooter(classDoc);
   223                 writer.writeFooter(classDoc);
   241         }
   224         }
   242 
   225 
   243         /**
   226         /**
   244          * Return the field writer for this builder.
   227          * Return the field writer for this builder.