Class DocSymbolProvider.FileExtensionDecorator

java.lang.Object
software.amazon.smithy.docgen.DocSymbolProvider.FileExtensionDecorator
All Implemented Interfaces:
SymbolProvider
Enclosing class:
DocSymbolProvider

public static final class DocSymbolProvider.FileExtensionDecorator extends Object implements SymbolProvider
Adds file extensions to symbol definition files. Used with DocFormat by default.

Symbols can set DocSymbolProvider.ENABLE_DEFAULT_FILE_EXTENSION to false to disable this on a per-symbol basis.

  • Constructor Details

    • FileExtensionDecorator

      public FileExtensionDecorator(SymbolProvider wrapped, String extension)
      Constructor.
      Parameters:
      wrapped - The symbol provider to wrap.
      extension - The file extension to add. This must include any necessary periods.
  • Method Details

    • toSymbol

      public Symbol toSymbol(Shape shape)
      Description copied from interface: SymbolProvider
      Gets the symbol to define for the given shape.

      A "symbol" represents the qualified name of a type in a target programming language.

      • When given a structure, union, resource, or service shape, this method should provide the namespace and name of the type to generate.
      • When given a simple type like a string, number, or timestamp, this method should return the language-specific type of the shape.
      • When given a member shape, this method should return the language specific type to use as the target of the member.
      • When given a list, set, or map, this method should return the language specific type to use for the shape (e.g., a map shape for a Python code generator might return "dict".
      Specified by:
      toSymbol in interface SymbolProvider
      Parameters:
      shape - Shape to get the class name of.
      Returns:
      Returns the generated class name.
    • toMemberName

      public String toMemberName(MemberShape shape)
      Description copied from interface: SymbolProvider
      Converts a member shape to a member/property name of a containing data structure.

      The default implementation will return the member name of the provided shape ID and should be overridden if necessary.

      Specified by:
      toMemberName in interface SymbolProvider
      Parameters:
      shape - Shape to convert.
      Returns:
      Returns the converted member name.