Class Selector.Runner
- java.lang.Object
-
- software.amazon.smithy.model.selector.Selector.Runner
-
- Enclosing interface:
- Selector
public static final class Selector.Runner extends java.lang.Object
Builds the execution environment for a selector and executes selectors.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Selector.Runner
model(Model model)
Sets the required model to use to select shapes with.void
selectMatches(java.util.function.BiConsumer<Shape,java.util.Map<java.lang.String,java.util.Set<Shape>>> matchConsumer)
Matches a selector to a set of shapes and receives each matched shape with the variables that were set when the shape was matched.java.util.Set<Shape>
selectShapes()
Runs the selector and returns the set of matching shapes.
-
-
-
Method Detail
-
model
public Selector.Runner model(Model model)
Sets the required model to use to select shapes with.- Parameters:
model
- Model used in the selector evaluation.- Returns:
- Returns the Runner.
-
selectShapes
public java.util.Set<Shape> selectShapes()
Runs the selector and returns the set of matching shapes.- Returns:
- Returns the set of matching shapes.
- Throws:
java.lang.IllegalStateException
- if amodel
has not been set.
-
selectMatches
public void selectMatches(java.util.function.BiConsumer<Shape,java.util.Map<java.lang.String,java.util.Set<Shape>>> matchConsumer)
Matches a selector to a set of shapes and receives each matched shape with the variables that were set when the shape was matched.- Parameters:
matchConsumer
- Receives each matched shape and the vars available when the shape was matched.- Throws:
java.lang.IllegalStateException
- if amodel
has not been set.
-
-