Class ElementSource
java.lang.Object
com.google.inject.spi.ElementSource
Contains information about where and how an
element was bound.
The declaring source refers to a location in source code that
defines the Guice element. For example, if the element is created from a method
annotated by @Provides, the declaring source of element would be the method itself.
The sequence of class names of modules involved in the
element creation can be retrieved by getModuleClassNames(). The order of the module
class names is reverse chronological. The first module (index 0) is the module that installs the
element. The last module is the root module.
In order to support the cases where a Guice element is created from another
Guice element (original) (e.g., by Element.applyTo(Binder)), it also provides a
reference to the original element source (getOriginalElementSource()).
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns a single location in source code that defines the element.Returns the class names of modules involved in creating thisElement.Returns theElementSourceof the element this was created or copied from.toString()ReturnsgetDeclaringSource().toString()value.
-
Method Details
-
getOriginalElementSource
Returns theElementSourceof the element this was created or copied from. If this was not created or copied from another element, returnsnull. -
getDeclaringSource
Returns a single location in source code that defines the element. It can be any object such asConstructor,Method,Field,StackTraceElement, etc. For example, if the element is created from a method annotated by @Provides, the declaring source of element would be the method itself. -
getModuleClassNames
-
toString
-