001    /*
002     * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
003     * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004     *
005     * This code is free software; you can redistribute it and/or modify it
006     * under the terms of the GNU General Public License version 2 only, as
007     * published by the Free Software Foundation.  Sun designates this
008     * particular file as subject to the "Classpath" exception as provided
009     * by Sun in the LICENSE file that accompanied this code.
010     *
011     * This code is distributed in the hope that it will be useful, but WITHOUT
012     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014     * version 2 for more details (a copy is included in the LICENSE file that
015     * accompanied this code).
016     *
017     * You should have received a copy of the GNU General Public License version
018     * 2 along with this work; if not, write to the Free Software Foundation,
019     * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020     *
021     * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022     * CA 95054 USA or visit www.sun.com if you need additional information or
023     * have any questions.
024     */
025    
026    package com.sun.tools.doclets.internal.toolkit.builders;
027    
028    import com.sun.tools.doclets.internal.toolkit.*;
029    import com.sun.tools.doclets.internal.toolkit.util.*;
030    import java.util.*;
031    
032    /**
033     * The superclass for all member builders.  Member builders are only executed
034     * within Class Builders.  They essentially build sub-components.  For example,
035     * method documentation is a sub-component of class documentation.
036     *
037     * This code is not part of an API.
038     * It is implementation that is subject to change.
039     * Do not use it as an API
040     *
041     * @author Jamie Ho
042     * @since 1.5
043     */
044    public abstract class AbstractMemberBuilder extends AbstractBuilder {
045    
046        /**
047         * Construct a SubBuilder.
048         * @param configuration the configuration used in this run
049         *        of the doclet.
050         */
051        public AbstractMemberBuilder(Configuration configuration) {
052            super(configuration);
053        }
054    
055        /**
056         * This method is not supported by sub-builders.
057         *
058         * @throws DocletAbortException this method will always throw a
059         * DocletAbortException because it is not supported.
060         */
061        public void build() throws DocletAbortException {
062            //You may not call the build method in a subbuilder.
063            throw new DocletAbortException();
064        }
065    
066    
067        /**
068         * Build the sub component if there is anything to document.
069         *
070         * @param elements {@inheritDoc}
071         */
072        public void build(List<?> elements) {
073            if (hasMembersToDocument()) {
074                super.build(elements);
075            }
076        }
077    
078        /**
079         * Return true if this subbuilder has anything to document.
080         *
081         * @return true if this subbuilder has anything to document.
082         */
083        public abstract boolean hasMembersToDocument();
084    }