Class SourceProvider


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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StackTraceElement get​(java.lang.StackTraceElement[] stackTraceElements)
      Returns the calling line of code.
      java.lang.Object getFromClassNames​(java.util.List<java.lang.String> moduleClassNames)
      Returns the non-skipped module class name.
      SourceProvider plusSkippedClasses​(java.lang.Class... moreClassesToSkip)
      Returns a new instance that also skips moreClassesToSkip.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UNKNOWN_SOURCE

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

        public static final SourceProvider DEFAULT_INSTANCE
    • Method Detail

      • plusSkippedClasses

        public SourceProvider plusSkippedClasses​(java.lang.Class... moreClassesToSkip)
        Returns a new instance that also skips moreClassesToSkip.
      • get

        public java.lang.StackTraceElement get​(java.lang.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 java.lang.Object getFromClassNames​(java.util.List<java.lang.String> moduleClassNames)
        Returns the non-skipped module class name.