Class TraceFile

  • All Implemented Interfaces:
    software.amazon.smithy.model.node.ToNode, software.amazon.smithy.utils.ToSmithyBuilder<TraceFile>

    public final class TraceFile
    extends java.lang.Object
    implements software.amazon.smithy.model.node.ToNode, software.amazon.smithy.utils.ToSmithyBuilder<TraceFile>
    Class that represents the contents of a Smithy trace file. TraceFile's require a smithyTrace file version number, TraceMetadata, and Map from ShapeId to a List of ShapeLink objects. TraceFile's optionally have a ArtifactDefinitions object. TraceFile handles parsing, serialization and deserialization of a Smithy trace file.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TraceFile.Builder
      Builder for constructing TraceFile's from scratch.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TraceFile.Builder builder()  
      static TraceFile fromNode​(software.amazon.smithy.model.node.Node value)
      Converts ObjectNode into TraceFile.
      java.util.Optional<ArtifactDefinitions> getArtifactDefinitions()
      Gets this TraceFile's Definitions.
      TraceMetadata getMetadata()
      Gets this TraceFile's TraceMetadata.
      java.util.Map<software.amazon.smithy.model.shapes.ShapeId,​java.util.List<ShapeLink>> getShapes()
      Gets this TraceFile's Shapes map.
      java.lang.String getSmithyTrace()
      Gets this TraceFile's smithyTrace.
      TraceFile.Builder toBuilder()
      Take this object and create a builder that contains all of the current property values of this object.
      software.amazon.smithy.model.node.ObjectNode toNode()
      Converts TraceFile instance variables into an ObjectNode.
      void validateModel​(software.amazon.smithy.model.Model model)
      Parses model and determines whether the trace file object meets the specs of the model by checking if the trace file contains all the ShapeIds in the model and the model contains all the ShapeIDs in the trace file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromNode

        public static TraceFile fromNode​(software.amazon.smithy.model.node.Node value)
        Converts ObjectNode into TraceFile.
        Parameters:
        value - an ObjectNode that represents the entire trace file.
        Returns:
        TraceFile produced from an ObjectNode.
      • toNode

        public software.amazon.smithy.model.node.ObjectNode toNode()
        Converts TraceFile instance variables into an ObjectNode.
        Specified by:
        toNode in interface software.amazon.smithy.model.node.ToNode
        Returns:
        ObjectNode representation of a TraceFile.
      • validateModel

        public void validateModel​(software.amazon.smithy.model.Model model)
        Parses model and determines whether the trace file object meets the specs of the model by checking if the trace file contains all the ShapeIds in the model and the model contains all the ShapeIDs in the trace file.
        Parameters:
        model - the Smithy model to validate the trace file against.
        Throws:
        software.amazon.smithy.model.node.ExpectationNotMetException - if model contains a ShapeID not in TraceFile or TraceFile contains a ShapeID not in model.
      • getSmithyTrace

        public java.lang.String getSmithyTrace()
        Gets this TraceFile's smithyTrace. The smithyTrace String contains the Smithy trace file version number.
        Returns:
        a String representing trace file ID.
      • getMetadata

        public TraceMetadata getMetadata()
        Gets this TraceFile's TraceMetadata.
        Returns:
        a TraceMetadata object.
      • getArtifactDefinitions

        public java.util.Optional<ArtifactDefinitions> getArtifactDefinitions()
        Gets this TraceFile's Definitions.
        Returns:
        an Optional Definitions container that contains this TraceFile's Definition or isEmpty if Definition's has not been set.
      • getShapes

        public java.util.Map<software.amazon.smithy.model.shapes.ShapeId,​java.util.List<ShapeLink>> getShapes()
        Gets this TraceFile's Shapes map. The shapes Map provides a mapping of absolute Smithy shape IDs to a list of shape link objects. A single Smithy shape can be responsible for generating multiple components in the target artifact.
        Returns:
        a Map from ShapeIDs to a list of ShapeLink's that represents the contents of the shapes tag in the trace file.
      • toBuilder

        public TraceFile.Builder toBuilder()
        Take this object and create a builder that contains all of the current property values of this object.
        Specified by:
        toBuilder in interface software.amazon.smithy.utils.ToSmithyBuilder<TraceFile>
        Returns:
        a builder for type T