Class BindingUtils
java.lang.Object
ru.vyarus.dropwizard.guice.module.installer.util.BindingUtils
Guice bindings utils.
- Since:
- 29.08.2019
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUsed to mark undeclared elemnts (not declared manually in any module). -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<? extends Annotation>findScopingAnnotation(Class<?> type, boolean countGuiceSpecific) Searches for scoping annotation on class.static StringgetDeclarationSource(com.google.inject.Binding binding) Resolve binding declaration source string, if possible.static Class<? extends com.google.inject.Module>getModuleClass(String name) Resolve class from module name, resolved from guiceElementsource.getModules(com.google.inject.spi.Element element) Resolve guice configuration element declaration module chain.static Class<? extends com.google.inject.Module>getTopDeclarationModule(com.google.inject.spi.Element element) May returnModuleif JIT binding provided.
-
Field Details
-
JIT_MODULE
Used to mark undeclared elemnts (not declared manually in any module).- See Also:
-
-
Method Details
-
getModules
Resolve guice configuration element declaration module chain. The first list element is declaration module. Later elements appear if module was installed by other module.Modules declared with lambda expression removed. If there are upper modules, declared normally then only they would remain (in report bindings would be should directly as module's bindings). When no upper modules exists then returned chain would contain only
Moduleto group all bindings from all root lambda modules into single "meta" module in the report (code links would still be correct in the report).- Parameters:
element- guice SPI element- Returns:
- modules chain from declaration point or single
JIT_MODULEif binding is a JIT binding
-
getModuleClass
Resolve class from module name, resolved from guiceElementsource. May returnModuleif element was a jit binding and provided name isJIT_MODULE.- Parameters:
name- module full class name (or jit marker)- Returns:
- module class or
Modulefor jit marker
-
getTopDeclarationModule
public static Class<? extends com.google.inject.Module> getTopDeclarationModule(com.google.inject.spi.Element element) May returnModuleif JIT binding provided.- Parameters:
element- guice SPI element- Returns:
- top module class name
-
getDeclarationSource
Resolve binding declaration source string, if possible.- Parameters:
binding- binding- Returns:
- binding declaration source
-
findScopingAnnotation
public static Class<? extends Annotation> findScopingAnnotation(Class<?> type, boolean countGuiceSpecific) Searches for scoping annotation on class. Base classes are not checked as scope is not inheritable.- Parameters:
type- class to search forcountGuiceSpecific- true to count guice-specific annotations (withScopeAnnotation)- Returns:
- detected annotation or null
-