java.lang.Object
software.amazon.smithy.codegen.core.docs.Snippet
All Implemented Interfaces:
ToSmithyBuilder<Snippet>

public final class Snippet extends Object implements ToSmithyBuilder<Snippet>
Represents a generated snippet, potentially containing multiple logical files.

Snippets are generated code based on some trait or other shared definition, such as the ExamplesTrait. These are created by code generators and consumed by documentation tools, such as smithy-docgen.

  • Method Details

    • getTargetId

      public String getTargetId()
      Gets the identifier of what the snippet was generated for.

      If this snippet represents a generated example from the ExamplesTrait, this will be the title of the example.

      Returns:
      Returns the target identifier of the snippet.
    • getTitle

      public String getTitle()
      Gets the title of the snippet.

      This is distinct from the target ID as it identifies the specific snippet.

      Generally, the title should reflect the primary language of the snippet, such as "Python" for a Python snippet.

      Returns:
      Returns the title of the snippet.
    • getProtocol

      public Optional<ShapeId> getProtocol()
      Returns:
      Optionally returns the ShapeId of the protocol associated with this snippet.
    • getFiles

      public List<SnippetFile> getFiles()
      Returns:
      Returns the files that comprise the snippet.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toBuilder

      public Snippet.Builder toBuilder()
      Description copied from interface: ToSmithyBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToSmithyBuilder<Snippet>
      Returns:
      a builder for type T
    • builder

      public static Snippet.Builder builder()
      Returns:
      Returns a new Snippet builder.