001package ball.tools.javadoc;
002/*-
003 * ##########################################################################
004 * Utilities
005 * $Id: SunToolsInternalToolkitTaglet.html 5431 2020-02-12 19:03:17Z ball $
006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/hcf-dev/blog/2019-03-30-java-interface-facades/src/main/resources/javadoc/src-html/ball/tools/javadoc/SunToolsInternalToolkitTaglet.html $
007 * %%
008 * Copyright (C) 2008 - 2020 Allen D. Ball
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the "License");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 *
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 *
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an "AS IS" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * ##########################################################################
022 */
023import com.sun.javadoc.Doc;
024import com.sun.javadoc.Tag;
025import com.sun.tools.doclets.formats.html.markup.RawHtml;
026import com.sun.tools.doclets.internal.toolkit.Configuration;
027import com.sun.tools.doclets.internal.toolkit.Content;
028import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
029import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
030/* import com.sun.tools.doclets.internal.toolkit.util.Extern; */
031
032/**
033 * Default methods for legacy {@link Taglet} implementations.
034 *
035 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
036 * @version $Revision: 5431 $
037 */
038public interface SunToolsInternalToolkitTaglet extends Taglet,
039                                                       JavadocHTMLTemplates {
040    void set(Configuration configuration);
041
042    @Override
043    default Content getTagletOutput(Doc doc,
044                                    TagletWriter writer) throws IllegalArgumentException {
045        set(writer.configuration());
046
047        throw new IllegalArgumentException(doc.position() + ": "
048                                           + "Method not supported in taglet "
049                                           + getName() + ".");
050    }
051
052    @Override
053    default Content getTagletOutput(Tag tag,
054                                    TagletWriter writer) throws IllegalArgumentException {
055        set(writer.configuration());
056
057        Content content = writer.getOutputInstance();
058
059        content.addContent(new RawHtml(((AbstractTaglet) this).toString(tag)));
060
061        return content;
062    }
063}