Class Differences

java.lang.Object
software.amazon.smithy.diff.Differences
All Implemented Interfaces:
ToSmithyBuilder<Differences>

public final class Differences extends Object implements ToSmithyBuilder<Differences>
Queryable container for detected structural differences between two models.
  • Method Details

    • detect

      public static Differences detect(Model oldModel, Model newModel)
      Detects all differences between two models.
      Parameters:
      oldModel - The previous state of the model.
      newModel - The new state of the model.
      Returns:
      The set of differences between the two models.
    • getOldModel

      public Model getOldModel()
      Gets the old model.
      Returns:
      Returns the old model.
    • getNewModel

      public Model getNewModel()
      Gets the new model.
      Returns:
      Returns the new model.
    • addedShapes

      public Stream<Shape> addedShapes()
      Gets all added shapes.
      Returns:
      Returns a stream of each added shape.
    • addedShapes

      public <T extends Shape> Stream<T> addedShapes(Class<T> shapeType)
      Gets all of the added shapes of a specific type.
      Type Parameters:
      T - Type of shape.
      Parameters:
      shapeType - Type of shape to find.
      Returns:
      Returns a stream of each added shape of a specific type.
    • addedMetadata

      public Stream<Pair<String,Node>> addedMetadata()
      Gets all added metadata.

      Each Pair returned contains the name of the metadata key on the left of the Pair and the metadata value on the right.

      Returns:
      Returns a stream of added metadata.
    • removedShapes

      public Stream<Shape> removedShapes()
      Gets all removed shapes.
      Returns:
      Returns a stream of each removed shape.
    • removedShapes

      public <T extends Shape> Stream<T> removedShapes(Class<T> shapeType)
      Gets all of the removed shapes of a specific type.
      Type Parameters:
      T - Type of shape.
      Parameters:
      shapeType - Type of shape to find.
      Returns:
      Returns a stream of each removed shape of a specific type.
    • removedMetadata

      public Stream<Pair<String,Node>> removedMetadata()
      Gets all removed metadata.

      Each Pair returned contains the name of the metadata key on the left of the Pair and the metadata value on the right.

      Returns:
      Returns a stream of removed metadata.
    • changedShapes

      public Stream<ChangedShape<Shape>> changedShapes()
      Gets all changed shapes.
      Returns:
      Returns a stream of changed shapes.
    • changedShapes

      public <T extends Shape> Stream<ChangedShape<T>> changedShapes(Class<T> type)
      Gets all changed shapes of a specific type.
      Type Parameters:
      T - Type of shape.
      Parameters:
      type - Type of shape to find.
      Returns:
      Returns a stream of matching changed shapes.
    • changedMetadata

      public Stream<ChangedMetadata> changedMetadata()
      Gets a stream of all changed metadata.
      Returns:
      Returns the changed metadata.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • builder

      public static Differences.Builder builder()
      Constructs a Builder for Differences.

      For most uses of Differences, it should be constructed with detect(software.amazon.smithy.model.Model, software.amazon.smithy.model.Model).

    • toBuilder

      public SmithyBuilder<Differences> toBuilder()
      Description copied from interface: ToSmithyBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToSmithyBuilder<Differences>
      Returns:
      a builder for type T