Class GuiceModelUtils
java.lang.Object
ru.vyarus.dropwizard.guice.debug.report.guice.util.GuiceModelUtils
Utilities for parsed guice model analysis.
- Since:
- 15.08.2019
-
Method Summary
Modifier and TypeMethodDescriptionstatic StackTraceElementgetDeclarationSource(com.google.inject.spi.Element element) NOTE: this will work only for elements, parsed with SPI api, and not for real bindings!getModules(List<ModuleDeclaration> modules) static Class<? extends Annotation>getScope(com.google.inject.Binding<?> binding) Detects binding scope.static Map<com.google.inject.Key,BindingDeclaration> index(List<ModuleDeclaration> modules) static StringrenderKey(com.google.inject.Key key) static StringrenderSource(com.google.inject.spi.Element element) Render element declaration source.static voidvisit(List<ModuleDeclaration> modules, Consumer<ModuleDeclaration> consumer) Applies callback to all modules in tree.static voidvisitBindings(List<ModuleDeclaration> modules, Consumer<BindingDeclaration> consumer) Applies callback to all bindings in tree.
-
Method Details
-
getModules
- Parameters:
modules- modules tree- Returns:
- list of module classes, used in tree or empty list
-
index
- Parameters:
modules- modules tree- Returns:
- index of bindings with non null key or empty map
-
visit
Applies callback to all modules in tree.- Parameters:
modules- modules treeconsumer- callback
-
visitBindings
public static void visitBindings(List<ModuleDeclaration> modules, Consumer<BindingDeclaration> consumer) Applies callback to all bindings in tree.- Parameters:
modules- modules treeconsumer- callback
-
getScope
Detects binding scope.- Parameters:
binding- binding- Returns:
- binding scope
-
renderKey
- Parameters:
key- guice binding key- Returns:
- string representation for key or "-" if key is null
-
getDeclarationSource
NOTE: this will work only for elements, parsed with SPI api, and not for real bindings!- Parameters:
element- guice binding element- Returns:
- element declaration stacktrace element
-
renderSource
Render element declaration source.- Parameters:
element- guice element- Returns:
- element declaration source or null
-