Top Description Fields Constructors Methods
com.google.inject.internal.util

public final Class SourceProvider

extends Object
Class Inheritance
Imports
com.google.common.base.Preconditions, com.google.common.collect.ImmutableSet, .Lists, java.util.List

Provides access to the calling line of code.
Author
[email protected] (Bob Lee)

Field Summary

Modifier and TypeField and Description
private final ImmutableSet<String>
public static final SourceProvider
private static final CallerFinder
private final SourceProvider
public static final Object
UNKNOWN_SOURCE

Indicates that the source is unknown.

Constructor Summary

AccessConstructor and Description
private
SourceProvider(Iterable<String> classesToSkip)

private
SourceProvider(SourceProvider parent, Iterable<String> classesToSkip)

Method Summary

Modifier and TypeMethod and Description
private static List<String>
asStrings(Class<?>... classes)

Returns the class names as Strings

public StackTraceElement
getCaller()

Returns the calling line of code.

public Object
getFromClassNames(List<String> moduleClassNames)

Returns the non-skipped module class name.

private static CallerFinder
public SourceProvider
plusSkippedClasses(Class<?>... moreClassesToSkip)

Returns a new instance that also skips moreClassesToSkip.

private boolean
shouldBeSkipped(String className)

Returns true if the className should be skipped.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classNamesToSkipback to summary
private final ImmutableSet<String> classNamesToSkip
DEFAULT_INSTANCEback to summary
public static final SourceProvider DEFAULT_INSTANCE
FINDERback to summary
private static final CallerFinder FINDER
parentback to summary
private final SourceProvider parent
UNKNOWN_SOURCEback to summary
public static final Object UNKNOWN_SOURCE

Indicates that the source is unknown.

Constructor Detail

SourceProviderback to summary
private SourceProvider(Iterable<String> classesToSkip)
SourceProviderback to summary
private SourceProvider(SourceProvider parent, Iterable<String> classesToSkip)

Method Detail

asStringsback to summary
private static List<String> asStrings(Class<?>... classes)

Returns the class names as Strings

getCallerback to summary
public StackTraceElement getCaller()

Returns the calling line of code. The selected line is the nearest to the top of the stack that is not skipped.

getFromClassNamesback to summary
public Object getFromClassNames(List<String> moduleClassNames)

Returns the non-skipped module class name.

loadCallerFinderback to summary
private static CallerFinder loadCallerFinder()
plusSkippedClassesback to summary
public SourceProvider plusSkippedClasses(Class<?>... moreClassesToSkip)

Returns a new instance that also skips moreClassesToSkip.

shouldBeSkippedback to summary
private boolean shouldBeSkipped(String className)

Returns true if the className should be skipped.