Class SourceProvider

java.lang.Object
com.google.inject.internal.util.SourceProvider

public final class SourceProvider extends Object
Provides access to the calling line of code.
  • Field Details

    • UNKNOWN_SOURCE

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

      private final SourceProvider parent
    • classNamesToSkip

      private final com.google.common.collect.ImmutableSet<String> classNamesToSkip
    • DEFAULT_INSTANCE

      public static final SourceProvider DEFAULT_INSTANCE
  • Constructor Details

  • Method Details

    • plusSkippedClasses

      public SourceProvider plusSkippedClasses(Class... moreClassesToSkip)
      Returns a new instance that also skips moreClassesToSkip.
    • shouldBeSkipped

      private boolean shouldBeSkipped(String className)
      Returns true if the className should be skipped.
    • asStrings

      private static List<String> asStrings(Class... classes)
      Returns the class names as Strings
    • 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.