Class UnstableInterceptor
java.lang.Object
software.amazon.smithy.docgen.interceptors.UnstableInterceptor
- All Implemented Interfaces:
CodeInterceptor<ShapeSubheadingSection,
DocWriter>
public final class UnstableInterceptor
extends Object
implements CodeInterceptor<ShapeSubheadingSection,DocWriter>
Adds a warning admonition to shapes marked as
unstable.
-
Nested Class Summary
Nested classes/interfaces inherited from interface software.amazon.smithy.utils.CodeInterceptor
CodeInterceptor.Appender<S extends CodeSection,
W extends AbstractCodeWriter<W>>, CodeInterceptor.Prepender<S extends CodeSection, W extends AbstractCodeWriter<W>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isIntercepted
(ShapeSubheadingSection section) Checks if the given section is filtered by this interceptor or not.Get the strongly typedCodeSection
this interceptor is used to intercept.void
write
(DocWriter writer, String previousText, ShapeSubheadingSection section) Intercepts anAbstractCodeWriter
section.
-
Constructor Details
-
UnstableInterceptor
public UnstableInterceptor()
-
-
Method Details
-
sectionType
Description copied from interface:CodeInterceptor
Get the strongly typedCodeSection
this interceptor is used to intercept.- Specified by:
sectionType
in interfaceCodeInterceptor<ShapeSubheadingSection,
DocWriter> - Returns:
- The code section to intercept.
-
isIntercepted
Description copied from interface:CodeInterceptor
Checks if the given section is filtered by this interceptor or not.In some cases
CodeInterceptor.sectionType()
might allow filtering a wider array of types than what is actually filtered by an interceptor. The most common example of this is intercepting any type of CodeSection and only filtering based on the result ofCodeSection.sectionName()
.This method will return
true
by default, meaning that any type ofCodeSection
that is an instance of the class returned fromCodeInterceptor.sectionType()
will be intercepted.- Specified by:
isIntercepted
in interfaceCodeInterceptor<ShapeSubheadingSection,
DocWriter> - Parameters:
section
- Section to test if this interceptor is relevant.- Returns:
- Returns true if the section is intercepted or not.
-
write
Description copied from interface:CodeInterceptor
Intercepts anAbstractCodeWriter
section.- Specified by:
write
in interfaceCodeInterceptor<ShapeSubheadingSection,
DocWriter> - Parameters:
writer
- Writer used to write content. If no write calls are made, any intercepted text is lost.previousText
- The previous text that was written. This text needs to be written again in order for it to be kept in the section.section
- The strongly typed section value.
-