src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java
changeset 49879 601277b1d582
parent 47216 71c04702a3d5
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
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.javadoc.internal.doclets.toolkit.builders;
    26 package jdk.javadoc.internal.doclets.toolkit.builders;
    27 
    27 
       
    28 import java.util.List;
       
    29 import javax.lang.model.element.Element;
       
    30 import javax.lang.model.element.TypeElement;
       
    31 
    28 import jdk.javadoc.internal.doclets.toolkit.Content;
    32 import jdk.javadoc.internal.doclets.toolkit.Content;
    29 import jdk.javadoc.internal.doclets.toolkit.DocletException;
    33 import jdk.javadoc.internal.doclets.toolkit.DocletException;
       
    34 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
       
    35 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind;
    30 
    36 
    31 /**
    37 /**
    32  * The superclass for all member builders.  Member builders are only executed
    38  * The superclass for all member builders.  Member builders are only executed
    33  * within Class Builders.  They essentially build sub-components.  For example,
    39  * within Class Builders.  They essentially build sub-components.  For example,
    34  * method documentation is a sub-component of class documentation.
    40  * method documentation is a sub-component of class documentation.
    40  *
    46  *
    41  * @author Jamie Ho
    47  * @author Jamie Ho
    42  */
    48  */
    43 public abstract class AbstractMemberBuilder extends AbstractBuilder {
    49 public abstract class AbstractMemberBuilder extends AbstractBuilder {
    44 
    50 
       
    51     final protected TypeElement typeElement;
       
    52 
       
    53     final protected VisibleMemberTable visibleMemberTable;
       
    54 
    45     /**
    55     /**
    46      * Construct a SubBuilder.
    56      * Construct a SubBuilder.
    47      * @param context a context object, providing information used in this run
    57      * @param context a context object, providing information used in this run
    48      *        of the doclet.
    58      *        of the doclet.
    49      */
    59      */
    50     public AbstractMemberBuilder(Context context) {
    60     public AbstractMemberBuilder(Context context, TypeElement typeElement) {
    51         super(context);
    61         super(context);
       
    62         this.typeElement = typeElement;
       
    63         visibleMemberTable = configuration.getVisibleMemberTable(typeElement);
    52     }
    64     }
    53 
    65 
    54     /**
    66     /**
    55      * This method is not supported by sub-builders.
    67      * This method is not supported by sub-builders.
    56      *
    68      *
    75      * Returns true if this subbuilder has anything to document.
    87      * Returns true if this subbuilder has anything to document.
    76      *
    88      *
    77      * @return true if this subbuilder has anything to document
    89      * @return true if this subbuilder has anything to document
    78      */
    90      */
    79     public abstract boolean hasMembersToDocument();
    91     public abstract boolean hasMembersToDocument();
       
    92 
       
    93     /**
       
    94      * Returns a list of visible elements of the specified kind in this
       
    95      * type element.
       
    96      * @param kind of members
       
    97      * @return a list of members
       
    98      */
       
    99     protected List<? extends Element> getVisibleMembers(Kind kind) {
       
   100         return visibleMemberTable.getVisibleMembers(kind);
       
   101     }
    80 }
   102 }