Class SourceProvider


  • public final class SourceProvider
    extends Object
    Provides access to the calling line of code.
    Author:
    crazybob@google.com (Bob Lee)
    • Field Detail

      • UNKNOWN_SOURCE

        public static final Object UNKNOWN_SOURCE
        Indicates that the source is unknown.
      • DEFAULT_INSTANCE

        public static final SourceProvider DEFAULT_INSTANCE
    • Method Detail

      • plusSkippedClasses

        public SourceProvider plusSkippedClasses​(Class<?>... moreClassesToSkip)
        Returns a new instance that also skips moreClassesToSkip.
      • get

        public StackTraceElement get​(StackTraceElement[] stackTraceElements)
        Returns the calling line of code. The selected line is the nearest to the top of the stack that is not skipped.
      • getFromClassNames

        public Object getFromClassNames​(List<String> moduleClassNames)
        Returns the non-skipped module class name.