src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java
changeset 49879 601277b1d582
parent 47216 71c04702a3d5
child 54060 53a95878619f
equal deleted inserted replaced
49878:2422d4e027b0 49879:601277b1d582
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    33 
    33 
    34 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
    34 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
    35 import jdk.javadoc.internal.doclets.toolkit.Content;
    35 import jdk.javadoc.internal.doclets.toolkit.Content;
    36 import jdk.javadoc.internal.doclets.toolkit.DocletException;
    36 import jdk.javadoc.internal.doclets.toolkit.DocletException;
    37 import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
    37 import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
    38 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
       
    39 
    38 
       
    39 import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.*;
    40 
    40 
    41 /**
    41 /**
    42  * Builds documentation for a field.
    42  * Builds documentation for a field.
    43  *
    43  *
    44  *  <p><b>This is NOT part of any supported API.
    44  *  <p><b>This is NOT part of any supported API.
    50  * @author Bhavesh Patel (Modified)
    50  * @author Bhavesh Patel (Modified)
    51  */
    51  */
    52 public class FieldBuilder extends AbstractMemberBuilder {
    52 public class FieldBuilder extends AbstractMemberBuilder {
    53 
    53 
    54     /**
    54     /**
    55      * The class whose fields are being documented.
       
    56      */
       
    57     private final TypeElement typeElement;
       
    58 
       
    59     /**
       
    60      * The visible fields for the given class.
       
    61      */
       
    62     private final VisibleMemberMap visibleMemberMap;
       
    63 
       
    64     /**
       
    65      * The writer to output the field documentation.
    55      * The writer to output the field documentation.
    66      */
    56      */
    67     private final FieldWriter writer;
    57     private final FieldWriter writer;
    68 
    58 
    69     /**
    59     /**
    70      * The list of fields being documented.
    60      * The list of fields being documented.
    71      */
    61      */
    72     private final List<Element> fields;
    62     private final List<? extends Element> fields;
    73 
    63 
    74     /**
    64     /**
    75      * The index of the current field that is being documented at this point
    65      * The index of the current field that is being documented at this point
    76      * in time.
    66      * in time.
    77      */
    67      */
    83      * @param context  the build context.
    73      * @param context  the build context.
    84      * @param typeElement the class whoses members are being documented.
    74      * @param typeElement the class whoses members are being documented.
    85      * @param writer the doclet specific writer.
    75      * @param writer the doclet specific writer.
    86      */
    76      */
    87     private FieldBuilder(Context context,
    77     private FieldBuilder(Context context,
    88             TypeElement typeElement,
    78                          TypeElement typeElement,
    89             FieldWriter writer) {
    79                          FieldWriter writer) {
    90         super(context);
    80         super(context, typeElement);
    91         this.typeElement = typeElement;
       
    92         this.writer = writer;
    81         this.writer = writer;
    93         visibleMemberMap = configuration.getVisibleMemberMap(typeElement,
    82         fields = getVisibleMembers(FIELDS);
    94                 VisibleMemberMap.Kind.FIELDS);
       
    95         fields = visibleMemberMap.getLeafMembers();
       
    96     }
    83     }
    97 
    84 
    98     /**
    85     /**
    99      * Construct a new FieldBuilder.
    86      * Construct a new FieldBuilder.
   100      *
    87      *