Class SourceLocationUtils

java.lang.Object
software.amazon.smithy.rulesengine.language.util.SourceLocationUtils

public final class SourceLocationUtils extends Object
  • Method Details

    • javaLocation

      public static SourceLocation javaLocation()
      Returns the source code location of the caller. This is very helpful when determining where rules generated from Java-based builders originated.

      Library-local and JDK stack frames are discarded. If no relevant location can be found, `SourceLocation.none()` is returned.

      Returns:
      The SourceLocation.
    • stackTraceForm

      public static String stackTraceForm(SourceLocation sourceLocation)
      Prints a source location in "stack trace form": `filename:linenumber`.
      Parameters:
      sourceLocation - Source location to print
      Returns:
      formatted source location