Class GuiceModelParser


  • public final class GuiceModelParser
    extends java.lang.Object
    Guice introspection utils. Parse guice SPI model. Supports both elements from modules and injector bindings.
    Since:
    14.08.2019
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<ModuleDeclaration> parse​(com.google.inject.Injector injector, java.util.Collection<? extends com.google.inject.spi.Element> elements)
      Parse guice elements into modules tree.
      static BindingDeclaration parseElement​(com.google.inject.Injector injector, com.google.inject.spi.Element element)
      Parse single guice element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • parse

        public static java.util.List<ModuleDeclaration> parse​(com.google.inject.Injector injector,
                                                              java.util.Collection<? extends com.google.inject.spi.Element> elements)
        Parse guice elements into modules tree. Only direct bindings are accepted. Supports both module elements and injector bindings (but result will slightly vary). JIT bindings are also grouped into special module.
        Parameters:
        injector - injector instance
        elements - elements to analyze
        Returns:
        tree of modules.
      • parseElement

        public static BindingDeclaration parseElement​(com.google.inject.Injector injector,
                                                      com.google.inject.spi.Element element)
        Parse single guice element.
        Parameters:
        injector - injector instance
        element - element to analyze
        Returns:
        parsed descriptor or null if element is not supported (or intentionally skipped)