Class Walker
java.lang.Object
software.amazon.smithy.model.neighbor.Walker
Walks connected shapes within a Model.
Any shape that is connected to another shape is "walked". A single shape can have multiple relationships to the same shape. For example, a resource can have both a "get" and a "child" relationship to an operation; however, the referenced operation will appear only once in the walker output.
Only shapes form a connected graph. Relationships created by traits are not traversed by the walker.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioniterateShapes(Shape shape) Lazily iterates over all of the relationships in the closure of the given shape, including the given shape.iterateShapes(Shape shape, Predicate<Relationship> predicate) Lazily iterates over all of the unique shapes in the closure of the given shape, including the given shape.walkShapeIds(Shape shape) Walks connected shapes in the model, returning their IDs in a set.walkShapeIds(Shape shape, Predicate<Relationship> predicate) Walks connected shapes in the model (including the given shape), and returns a set of shape IDs.walkShapes(Shape shape) Walks connected shapes in the model, returning them in a set.walkShapes(Shape shape, Predicate<Relationship> predicate) Walks connected shapes in the model (including the given shape), and returns them in a set.
-
Constructor Details
-
Walker
- Parameters:
model- Model to traverse.
-
Walker
- Parameters:
provider- Neighbor provider used to traverse relationships.
-
-
Method Details
-
walkShapes
Walks connected shapes in the model, returning them in a set.- Parameters:
shape- The shape to start the traversal from.- Returns:
- Returns a set of connected shapes.
-
walkShapes
Walks connected shapes in the model (including the given shape), and returns them in a set.- Parameters:
shape- The shape to start the traversal from.predicate- Predicate used to prevent traversing relationships.- Returns:
- Returns a set of connected shapes.
-
walkShapeIds
Walks connected shapes in the model, returning their IDs in a set.- Parameters:
shape- The shape to start the traversal from.- Returns:
- Returns a set of connected shape IDs.
-
walkShapeIds
Walks connected shapes in the model (including the given shape), and returns a set of shape IDs.- Parameters:
shape- The shape to start the traversal from.predicate- Predicate used to prevent traversing relationships.- Returns:
- Returns a set of connected shape IDs.
-
iterateShapes
Lazily iterates over all of the relationships in the closure of the given shape, including the given shape.- Parameters:
shape- Shape to find the closure of.- Returns:
- Returns an iterator of shapes connected to
shape.
-
iterateShapes
Lazily iterates over all of the unique shapes in the closure of the given shape, including the given shape.- Parameters:
shape- Shape to find the closure of.predicate- Predicate used to short-circuit relationship branches.- Returns:
- Returns an iterator of shapes connected to
shape.
-