Class SourceLocation

java.lang.Object
software.amazon.smithy.model.SourceLocation
All Implemented Interfaces:
Comparable<SourceLocation>, FromSourceLocation

public final class SourceLocation extends Object implements FromSourceLocation, Comparable<SourceLocation>
Represents the source location of a model component.
  • Field Details

  • Constructor Details

    • SourceLocation

      public SourceLocation(String filename, int line, int column)
    • SourceLocation

      public SourceLocation(String filename)
  • Method Details

    • none

      public static SourceLocation none()
      Creates an empty source location.
      Returns:
      Returns the empty location.
    • getFilename

      public String getFilename()
      Returns:
      Returns the source location filename.
    • getLine

      public int getLine()
      Returns:
      Returns the line number from which the component originated.
    • getColumn

      public int getColumn()
      Returns:
      Returns the column from which the component originated.
    • getSourceLocation

      public SourceLocation getSourceLocation()
      Description copied from interface: FromSourceLocation
      Gets the source location of a value.
      Specified by:
      getSourceLocation in interface FromSourceLocation
      Returns:
      Returns the source location of the value.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

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

      public int compareTo(SourceLocation o)
      Specified by:
      compareTo in interface Comparable<SourceLocation>