Class TraceFile
java.lang.Object
software.amazon.smithy.codegen.core.trace.TraceFile
- All Implemented Interfaces:
ToNode
,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
Modifier and TypeClassDescriptionstatic final class
Builder for constructing TraceFile's from scratch. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TraceFile.Builder
builder()
static TraceFile
Converts ObjectNode into TraceFile.Gets this TraceFile's Definitions.Gets this TraceFile's TraceMetadata.Gets this TraceFile's Shapes map.Gets this TraceFile's smithyTrace.Take this object and create a builder that contains all of the current property values of this object.toNode()
Converts TraceFile instance variables into an ObjectNode.void
validateModel
(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.
-
Field Details
-
SMITHY_TRACE_TEXT
- See Also:
-
METADATA_TEXT
- See Also:
-
DEFINITIONS_TEXT
- See Also:
-
SHAPES_TEXT
- See Also:
-
SMITHY_TRACE_VERSION
- See Also:
-
-
Method Details
-
fromNode
Converts ObjectNode into TraceFile.- Parameters:
value
- an ObjectNode that represents the entire trace file.- Returns:
- TraceFile produced from an ObjectNode.
-
builder
-
toNode
Converts TraceFile instance variables into an ObjectNode. -
validateModel
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:
ExpectationNotMetException
- if model contains a ShapeID not in TraceFile or TraceFile contains a ShapeID not in model.
-
getSmithyTrace
Gets this TraceFile's smithyTrace. The smithyTraceString
contains the Smithy trace file version number.- Returns:
- a String representing trace file ID.
-
getMetadata
Gets this TraceFile's TraceMetadata.- Returns:
- a TraceMetadata object.
-
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
Gets this TraceFile's Shapes map. The shapesMap
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
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToSmithyBuilder<TraceFile>
- Returns:
- a builder for type T
-