langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
changeset 14542 7062120649c2
parent 14260 727a84636f12
child 16319 e586bfeb39c5
equal deleted inserted replaced
14541:36f9d11fc9aa 14542:7062120649c2
    58     public static final int MAX_CONSTANT_VALUE_INDEX_LENGTH = 2;
    58     public static final int MAX_CONSTANT_VALUE_INDEX_LENGTH = 2;
    59 
    59 
    60     /**
    60     /**
    61      * The writer used to write the results.
    61      * The writer used to write the results.
    62      */
    62      */
    63     protected ConstantsSummaryWriter writer;
    63     protected final ConstantsSummaryWriter writer;
    64 
    64 
    65     /**
    65     /**
    66      * The set of ClassDocs that have constant fields.
    66      * The set of ClassDocs that have constant fields.
    67      */
    67      */
    68     protected Set<ClassDoc> classDocsWithConstFields;
    68     protected final Set<ClassDoc> classDocsWithConstFields;
    69 
    69 
    70     /**
    70     /**
    71      * The set of printed package headers.
    71      * The set of printed package headers.
    72      */
    72      */
    73     protected Set<String> printedPackageHeaders;
    73     protected Set<String> printedPackageHeaders;
    88     private Content contentTree;
    88     private Content contentTree;
    89 
    89 
    90     /**
    90     /**
    91      * Construct a new ConstantsSummaryBuilder.
    91      * Construct a new ConstantsSummaryBuilder.
    92      *
    92      *
    93      * @param configuration the current configuration of the
    93      * @param context       the build context.
    94      *                      doclet.
    94      * @param writer        the writer for the summary.
    95      */
    95      */
    96     private ConstantsSummaryBuilder(Configuration configuration) {
    96     private ConstantsSummaryBuilder(Context context,
    97         super(configuration);
    97             ConstantsSummaryWriter writer) {
       
    98         super(context);
       
    99         this.writer = writer;
       
   100         this.classDocsWithConstFields = new HashSet<ClassDoc>();
    98     }
   101     }
    99 
   102 
   100     /**
   103     /**
   101      * Construct a ConstantsSummaryBuilder.
   104      * Construct a ConstantsSummaryBuilder.
   102      *
   105      *
   103      * @param configuration the configuration used in this run
   106      * @param context       the build context.
   104      *                      of the doclet.
       
   105      * @param writer        the writer for the summary.
   107      * @param writer        the writer for the summary.
   106      */
   108      */
   107     public static ConstantsSummaryBuilder getInstance(
   109     public static ConstantsSummaryBuilder getInstance(Context context,
   108         Configuration configuration, ConstantsSummaryWriter writer) {
   110             ConstantsSummaryWriter writer) {
   109         ConstantsSummaryBuilder builder = new ConstantsSummaryBuilder(
   111         return new ConstantsSummaryBuilder(context, writer);
   110             configuration);
       
   111         builder.writer = writer;
       
   112         builder.classDocsWithConstFields = new HashSet<ClassDoc>();
       
   113         return builder;
       
   114     }
   112     }
   115 
   113 
   116     /**
   114     /**
   117      * {@inheritDoc}
   115      * {@inheritDoc}
   118      */
   116      */
   119     public void build() throws IOException {
   117     public void build() throws IOException {
   120         if (writer == null) {
   118         if (writer == null) {
   121             //Doclet does not support this output.
   119             //Doclet does not support this output.
   122             return;
   120             return;
   123         }
   121         }
   124         build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
   122         build(layoutParser.parseXML(ROOT), contentTree);
   125     }
   123     }
   126 
   124 
   127     /**
   125     /**
   128      * {@inheritDoc}
   126      * {@inheritDoc}
   129      */
   127      */