Class PathFinder.Path

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<Relationship>
software.amazon.smithy.model.selector.PathFinder.Path
All Implemented Interfaces:
Iterable<Relationship>, Collection<Relationship>, List<Relationship>
Enclosing class:
PathFinder

public static final class PathFinder.Path extends AbstractList<Relationship>
An immutable Relationship path from a starting shape to an end shape.
  • Constructor Details

  • Method Details

    • size

      public int size()
      Specified by:
      size in interface Collection<Relationship>
      Specified by:
      size in interface List<Relationship>
      Specified by:
      size in class AbstractCollection<Relationship>
    • get

      public Relationship get(int index)
      Specified by:
      get in interface List<Relationship>
      Specified by:
      get in class AbstractList<Relationship>
    • getShapes

      public List<Shape> getShapes()
      Gets a list of all shapes in the path including the starting shape all the way to the last shape.

      The returned list does not return the last element (the end shape targeted by the last neighbor) if it does not exist.

      Returns:
      Returns the list of shapes.
    • getStartShape

      public Shape getStartShape()
      Gets the starting shape of the Path.
      Returns:
      Returns the starting shape of the Path.
    • getEndShape

      public Shape getEndShape()
      Gets the ending shape of the Path that matched the selector and is connected to the starting shape.
      Returns:
      Returns the ending shape of the Path.
      Throws:
      SourceException - if the last relationship is invalid.
    • toString

      public String toString()
      Converts the path to valid Selector syntax.
      Overrides:
      toString in class AbstractCollection<Relationship>
      Returns:
      Returns the path as a selector.