Package com.google.inject.internal.util
Class SourceProvider
- java.lang.Object
-
- com.google.inject.internal.util.SourceProvider
-
public final class SourceProvider extends java.lang.Object
Provides access to the calling line of code.
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.ImmutableSet<java.lang.String>
classNamesToSkip
static SourceProvider
DEFAULT_INSTANCE
private SourceProvider
parent
static java.lang.Object
UNKNOWN_SOURCE
Indicates that the source is unknown.
-
Constructor Summary
Constructors Modifier Constructor Description private
SourceProvider(SourceProvider parent, java.lang.Iterable<java.lang.String> classesToSkip)
private
SourceProvider(java.lang.Iterable<java.lang.String> classesToSkip)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.List<java.lang.String>
asStrings(java.lang.Class<?>... classes)
Returns the class names as Stringsjava.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 skipsmoreClassesToSkip
.private boolean
shouldBeSkipped(java.lang.String className)
Returns true if the className should be skipped.
-
-
-
Field Detail
-
UNKNOWN_SOURCE
public static final java.lang.Object UNKNOWN_SOURCE
Indicates that the source is unknown.
-
parent
private final SourceProvider parent
-
classNamesToSkip
private final com.google.common.collect.ImmutableSet<java.lang.String> classNamesToSkip
-
DEFAULT_INSTANCE
public static final SourceProvider DEFAULT_INSTANCE
-
-
Constructor Detail
-
SourceProvider
private SourceProvider(java.lang.Iterable<java.lang.String> classesToSkip)
-
SourceProvider
private SourceProvider(SourceProvider parent, java.lang.Iterable<java.lang.String> classesToSkip)
-
-
Method Detail
-
plusSkippedClasses
public SourceProvider plusSkippedClasses(java.lang.Class<?>... moreClassesToSkip)
Returns a new instance that also skipsmoreClassesToSkip
.
-
shouldBeSkipped
private boolean shouldBeSkipped(java.lang.String className)
Returns true if the className should be skipped.
-
asStrings
private static java.util.List<java.lang.String> asStrings(java.lang.Class<?>... classes)
Returns the class names as Strings
-
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.
-
-