001/*
002 * Copyright (c) 2003, 2022, Oracle and/or its affiliates. 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.  Oracle designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
022 * or visit www.oracle.com if you need additional information or have any
023 * questions.
024 */
025
026package org.jdrupes.mdoclet.internal.doclets.toolkit;
027
028import javax.lang.model.element.Element;
029import javax.lang.model.element.ModuleElement;
030import javax.lang.model.element.PackageElement;
031import javax.lang.model.element.TypeElement;
032
033import org.jdrupes.mdoclet.internal.doclets.toolkit.util.ClassTree;
034import org.jdrupes.mdoclet.internal.doclets.toolkit.util.VisibleMemberTable;
035
036/**
037 * The interface for a factory creates writers.
038 */
039public interface WriterFactory {
040
041    /**
042     * Return the writer for the constant summary.
043     *
044     * @return the writer for the constant summary.  Return null if this
045     * writer is not supported by the doclet.
046     */
047    ConstantsSummaryWriter getConstantsSummaryWriter();
048
049    /**
050     * Return the writer for the package summary.
051     *
052     * @param packageElement the package being documented
053     * @return the writer for the package summary.  Return null if this
054     * writer is not supported by the doclet.
055     */
056    PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement);
057
058    /**
059     * Return the writer for the module summary.
060     *
061     * @param mdle the module being documented
062     * @return the writer for the module summary.  Return null if this
063     * writer is not supported by the doclet.
064     */
065    ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle);
066
067    /**
068     * Returns the writer for a given type element,
069     * or null if this writer is not supported by the doclet.
070     *
071     * @param typeElement the class being documented
072     * @param classTree   the class tree
073     * @return the writer
074     */
075    ClassWriter getClassWriter(TypeElement typeElement, ClassTree classTree);
076
077    /**
078     * Return the method writer for a given type element,
079     * or null if this writer is not supported by the doclet.
080     *
081     * @param classWriter the writer for the class being documented
082     * @return the method writer
083     */
084    MethodWriter getMethodWriter(ClassWriter classWriter);
085
086    /**
087     * Return the annotation type member writer for a given annotation
088     * type, or null if this writer is not supported by the doclet.
089     *
090     * @param classWriter the writer for the annotation type being documented
091     * @return the member writer
092     */
093    AnnotationTypeMemberWriter getAnnotationTypeMemberWriter(
094            ClassWriter classWriter);
095
096    /**
097     * Return the annotation type optional member writer for a given annotation
098     * type, or null if this writer is not supported by the doclet.
099     *
100     * @param classWriter the writer for the annotation type being documented
101     * @return the member writer
102     */
103    AnnotationTypeMemberWriter getAnnotationTypeOptionalMemberWriter(
104            ClassWriter classWriter);
105
106    /**
107     * Return the annotation type required member writer for a given annotation
108     * type, or null if this writer is not supported by the doclet.
109     *
110     * @param classWriter the writer for the annotation type being documented
111     * @return the member writer
112     */
113    AnnotationTypeMemberWriter getAnnotationTypeRequiredMemberWriter(
114            ClassWriter classWriter);
115
116    /**
117     * Return the enum constant writer for a given type element,
118     * or null if this writer is not supported by the doclet.
119     *
120     * @param classWriter the writer for the type element being documented
121     * @return the enum constant writer
122     */
123    EnumConstantWriter getEnumConstantWriter(ClassWriter classWriter);
124
125    /**
126     * Return the field writer for a given type element,
127     * or null if this writer is not supported by the doclet.
128     *
129     * @param classWriter the writer for the class being documented
130     * @return the field writer for the given class.  Return null if this
131     * writer is not supported by the doclet.
132     */
133    FieldWriter getFieldWriter(ClassWriter classWriter);
134
135    /**
136     * Return the property writer for a given class,
137     * or null if this writer is not supported by the doclet.
138     *
139     * @param classWriter the writer for the type element being documented
140     * @return the property writer
141     */
142    PropertyWriter getPropertyWriter(ClassWriter classWriter);
143
144    /**
145     * Return the constructor writer for a given type element,
146     * or null if this writer is not supported by the doclet.
147     *
148     * @param classWriter the writer for the type element being documented
149     * @return the constructor writer
150     */
151    ConstructorWriter getConstructorWriter(ClassWriter classWriter);
152
153    /**
154     * Return the specified member summary writer for a given type element,
155     * or null if this writer is not supported by the doclet.
156     *
157     * @param classWriter the writer for the class being documented
158     * @param memberType  the {@link VisibleMemberTable} member type indicating
159     *                    the type of member summary that should be returned
160     * @return the summary writer
161     *
162     * @see VisibleMemberTable
163     */
164    MemberSummaryWriter getMemberSummaryWriter(ClassWriter classWriter,
165            VisibleMemberTable.Kind memberType);
166
167    /**
168     * Return the writer for the serialized form.
169     *
170     * @return the writer for the serialized form
171     */
172    SerializedFormWriter getSerializedFormWriter();
173
174    /**
175     * Return the handler for doc files.
176     *
177     * @return the handler for the doc files
178     */
179    DocFilesHandler getDocFilesHandler(Element pkg);
180}