Class ChangedShape<S extends software.amazon.smithy.model.shapes.Shape>

java.lang.Object
software.amazon.smithy.diff.ChangedShape<S>
Type Parameters:
S - The type of shape. Note that this may be just Shape in the event that the shape changed classes.
All Implemented Interfaces:
software.amazon.smithy.model.FromSourceLocation

public final class ChangedShape<S extends software.amazon.smithy.model.shapes.Shape> extends Object implements software.amazon.smithy.model.FromSourceLocation
Represents a changed shape.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChangedShape(S oldShape, S newShape)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Stream<software.amazon.smithy.model.traits.Trait>
    Gets a stream of added traits.
    Stream<software.amazon.smithy.utils.Pair<software.amazon.smithy.model.traits.Trait,software.amazon.smithy.model.traits.Trait>>
    Gets a stream of changed traits.
    boolean
     
    <T extends software.amazon.smithy.model.traits.Trait>
    Optional<software.amazon.smithy.utils.Pair<T,T>>
    getChangedTrait(Class<T> traitType)
    Gets a changed trait of a specific type.
    Gets the new shape value.
    Gets the old shape value.
    software.amazon.smithy.model.shapes.ShapeId
    Gets the shape ID of the changed shape.
    software.amazon.smithy.model.SourceLocation
     
    Map<software.amazon.smithy.model.shapes.ShapeId,software.amazon.smithy.utils.Pair<software.amazon.smithy.model.traits.Trait,software.amazon.smithy.model.traits.Trait>>
    Gets the trait differences between the old and new shape.
    int
     
    Stream<software.amazon.smithy.model.traits.Trait>
    Gets a stream of removed traits.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ChangedShape

      public ChangedShape(S oldShape, S newShape)
  • Method Details

    • getOldShape

      public S getOldShape()
      Gets the old shape value.
      Returns:
      Returns the old shape.
    • getNewShape

      public S getNewShape()
      Gets the new shape value.
      Returns:
      Returns the new shape.
    • getSourceLocation

      public software.amazon.smithy.model.SourceLocation getSourceLocation()
      Specified by:
      getSourceLocation in interface software.amazon.smithy.model.FromSourceLocation
    • getShapeId

      public software.amazon.smithy.model.shapes.ShapeId getShapeId()
      Gets the shape ID of the changed shape.
      Returns:
      Return the shape ID.
    • addedTraits

      public Stream<software.amazon.smithy.model.traits.Trait> addedTraits()
      Gets a stream of added traits.
      Returns:
      Returns the traits that were added.
    • removedTraits

      public Stream<software.amazon.smithy.model.traits.Trait> removedTraits()
      Gets a stream of removed traits.
      Returns:
      Returns the traits that were removed.
    • changedTraits

      public Stream<software.amazon.smithy.utils.Pair<software.amazon.smithy.model.traits.Trait,software.amazon.smithy.model.traits.Trait>> changedTraits()
      Gets a stream of changed traits.
      Returns:
      Returns the traits that were changed.
    • getChangedTrait

      public <T extends software.amazon.smithy.model.traits.Trait> Optional<software.amazon.smithy.utils.Pair<T,T>> getChangedTrait(Class<T> traitType)
      Gets a changed trait of a specific type.
      Type Parameters:
      T - Type of trait to find.
      Parameters:
      traitType - Type of trait to find.
      Returns:
      Returns the optionally found old and new typed trait values.
    • getTraitDifferences

      public Map<software.amazon.smithy.model.shapes.ShapeId,software.amazon.smithy.utils.Pair<software.amazon.smithy.model.traits.Trait,software.amazon.smithy.model.traits.Trait>> getTraitDifferences()
      Gets the trait differences between the old and new shape.

      The returned map is a mapping of a trait name to a pair in which the left side of the pair contains the nullable old trait value, and the right side of the pair contains the nullable new trait value. The left side will be null if the trait was added, the right side will be null if the trait was removed, and both traits will be present if the trait changed.

      Returns:
      Returns a map of each changed trait name to a pair of the old and new trait values.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object