src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java
changeset 49879 601277b1d582
parent 47216 71c04702a3d5
child 54060 53a95878619f
equal deleted inserted replaced
49878:2422d4e027b0 49879:601277b1d582
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 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
    32 
    32 
    33 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter;
    33 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter;
    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.util.VisibleMemberMap;
    37 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
    38 
    38 
    39 
    39 
    40 /**
    40 /**
    41  * Builds documentation for annotation type fields.
    41  * Builds documentation for annotation type fields.
    42  *
    42  *
    48  * @author Bhavesh Patel
    48  * @author Bhavesh Patel
    49  */
    49  */
    50 public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
    50 public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
    51 
    51 
    52     /**
    52     /**
    53      * The annotation type whose members are being documented.
       
    54      */
       
    55     protected TypeElement typeElement;
       
    56 
       
    57     /**
       
    58      * The visible members for the given class.
       
    59      */
       
    60     protected VisibleMemberMap visibleMemberMap;
       
    61 
       
    62     /**
       
    63      * The writer to output the member documentation.
    53      * The writer to output the member documentation.
    64      */
    54      */
    65     protected AnnotationTypeFieldWriter writer;
    55     protected AnnotationTypeFieldWriter writer;
    66 
    56 
    67     /**
    57     /**
    68      * The list of members being documented.
    58      * The list of members being documented.
    69      */
    59      */
    70     protected List<Element> members;
    60     protected List<? extends Element> members;
    71 
    61 
    72     /**
    62     /**
    73      * The index of the current member that is being documented at this point
    63      * The index of the current member that is being documented at this point
    74      * in time.
    64      * in time.
    75      */
    65      */
    84      * @param memberType the type of member that is being documented.
    74      * @param memberType the type of member that is being documented.
    85      */
    75      */
    86     protected AnnotationTypeFieldBuilder(Context context,
    76     protected AnnotationTypeFieldBuilder(Context context,
    87             TypeElement typeElement,
    77             TypeElement typeElement,
    88             AnnotationTypeFieldWriter writer,
    78             AnnotationTypeFieldWriter writer,
    89             VisibleMemberMap.Kind memberType) {
    79             VisibleMemberTable.Kind memberType) {
    90         super(context);
    80         super(context, typeElement);
    91         this.typeElement = typeElement;
       
    92         this.writer = writer;
    81         this.writer = writer;
    93         this.visibleMemberMap = configuration.getVisibleMemberMap(typeElement, memberType);
    82         this.members = getVisibleMembers(memberType);
    94         this.members = this.visibleMemberMap.getMembers(typeElement);
       
    95     }
    83     }
    96 
    84 
    97 
    85 
    98     /**
    86     /**
    99      * Construct a new AnnotationTypeFieldBuilder.
    87      * Construct a new AnnotationTypeFieldBuilder.
   105      */
    93      */
   106     public static AnnotationTypeFieldBuilder getInstance(
    94     public static AnnotationTypeFieldBuilder getInstance(
   107             Context context, TypeElement typeElement,
    95             Context context, TypeElement typeElement,
   108             AnnotationTypeFieldWriter writer) {
    96             AnnotationTypeFieldWriter writer) {
   109         return new AnnotationTypeFieldBuilder(context, typeElement,
    97         return new AnnotationTypeFieldBuilder(context, typeElement,
   110                     writer, VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
    98                     writer, VisibleMemberTable.Kind.ANNOTATION_TYPE_FIELDS);
   111     }
    99     }
   112 
   100 
   113     /**
   101     /**
   114      * Returns whether or not there are members to document.
   102      * Returns whether or not there are members to document.
   115      * @return whether or not there are members to document
   103      * @return whether or not there are members to document