Package com.google.inject.spi
Class ModuleSource
java.lang.Object
com.google.inject.spi.ModuleSource
Associated to a
module, provides the module class name, the parent module source, and the call stack that ends just before the module configure(Binder) method invocation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe class name of module that thisModuleSourceassociated to.private final ModuleSourceThe parentmodule source.private final StackTraceElements.InMemoryStackTraceElement[]The chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateModuleSource(ModuleSource parent, Class<?> moduleClass, StackTraceElement[] partialCallStack) Creates a newModuleSourceObject.(package private)ModuleSource(Class<?> moduleClass, StackTraceElement[] partialCallStack) Creates a newModuleSourcewith a null parent. -
Method Summary
Modifier and TypeMethodDescription(package private) ModuleSourcecreateChild(Class<?> moduleClass, StackTraceElement[] partialCallStack) Creates and returns a childModuleSourcecorresponding to themodule.(package private) StringReturns the corresponding module class name.Returns the class names of modules in this module source.(package private) ModuleSourceReturns the parent modulesource.(package private) StackTraceElement[]Returns the chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation.(package private) intReturns the size of partial call stack if stack trace collection is on otherwise zero.(package private) StackTraceElement[]Returns the full call stack that ends just before the moduleconfigure(Binder)method invocation.(package private) intReturns the size of call stack that ends just before the moduleconfigure(Binder)method invocation (seegetStackTrace()).(package private) intsize()Returns the size ofModuleSourceschain (all parents) that ends at this object.
-
Field Details
-
moduleClassName
The class name of module that thisModuleSourceassociated to. -
parent
The parentmodule source. -
partialCallStack
The chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation. For a module without a parent module the chunk starts from the bottom of call stack. The array is non-empty if stack trace collection is on.
-
-
Constructor Details
-
ModuleSource
ModuleSource(Class<?> moduleClass, StackTraceElement[] partialCallStack) Creates a newModuleSourcewith a null parent.- Parameters:
moduleClass- the corresponding modulepartialCallStack- the chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation
-
ModuleSource
private ModuleSource(ModuleSource parent, Class<?> moduleClass, StackTraceElement[] partialCallStack) Creates a newModuleSourceObject.- Parameters:
parent- the parent modulesourcemoduleClass- the corresponding modulepartialCallStack- the chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation
-
-
Method Details
-
getModuleClassName
String getModuleClassName()Returns the corresponding module class name.- See Also:
-
getPartialCallStack
StackTraceElement[] getPartialCallStack()Returns the chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation. The return array is non-empty only if stack trace collection is on. -
getPartialCallStackSize
int getPartialCallStackSize()Returns the size of partial call stack if stack trace collection is on otherwise zero. -
createChild
Creates and returns a childModuleSourcecorresponding to themodule.- Parameters:
moduleClass- the corresponding modulepartialCallStack- the chunk of call stack that starts from the parent moduleconfigure(Binder)call and ends just before the moduleconfigure(Binder)method invocation
-
getParent
ModuleSource getParent()Returns the parent modulesource. -
getModuleClassNames
Returns the class names of modules in this module source. The first element (index 0) is filled by this objectgetModuleClassName(). The second element is filled by the parent'sgetModuleClassName()and so on. -
size
int size()Returns the size ofModuleSourceschain (all parents) that ends at this object. -
getStackTraceSize
int getStackTraceSize()Returns the size of call stack that ends just before the moduleconfigure(Binder)method invocation (seegetStackTrace()). -
getStackTrace
StackTraceElement[] getStackTrace()Returns the full call stack that ends just before the moduleconfigure(Binder)method invocation. The return array is non-empty if stack trace collection on.
-