All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.smithy.traitcodegen.integrations.javadoc.ExternalDocumentationInterceptor Maven / Gradle / Ivy

/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

package software.amazon.smithy.traitcodegen.integrations.javadoc;

import java.util.Map;
import software.amazon.smithy.model.traits.ExternalDocumentationTrait;
import software.amazon.smithy.traitcodegen.sections.JavaDocSection;
import software.amazon.smithy.traitcodegen.writer.TraitCodegenWriter;
import software.amazon.smithy.utils.CodeInterceptor;

/**
 * Adds the javadoc {@code @see} tag to the generated javadocs if the corresponding smithy shape
 * has the {@link ExternalDocumentationTrait} trait applied.
 *
 * 

Note: This interceptor should run before the {@link DeprecatedInterceptor} and {@link SinceInterceptor} * to ensure proper ordering of Javadoc tags. */ final class ExternalDocumentationInterceptor implements CodeInterceptor.Appender { @Override public void append(TraitCodegenWriter writer, JavaDocSection section) { ExternalDocumentationTrait trait = section.shape().expectTrait(ExternalDocumentationTrait.class); for (Map.Entry entry : trait.getUrls().entrySet()) { writer.write("@see $L", entry.getValue(), entry.getKey()); } } @Override public Class sectionType() { return JavaDocSection.class; } @Override public boolean isIntercepted(JavaDocSection section) { return section.shape().hasTrait(ExternalDocumentationTrait.class); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy