Class Elements


  • public final class Elements
    extends Object
    Exposes elements of a module so they can be inspected, validated or rewritten.
    Since:
    2.0
    Author:
    jessewilson@google.com (Jesse Wilson)
    • Constructor Detail

      • Elements

        public Elements()
    • Method Detail

      • getElements

        public static List<Element> getElements​(Module... modules)
        Records the elements executed by modules.
      • getElements

        public static List<Element> getElements​(Stage stage,
                                                Module... modules)
        Records the elements executed by modules.
      • getElements

        public static List<Element> getElements​(Iterable<? extends Module> modules)
        Records the elements executed by modules.
      • getElements

        public static List<Element> getElements​(Stage stage,
                                                Iterable<? extends Module> modules)
        Records the elements executed by modules.
      • withTrustedSource

        public static Binder withTrustedSource​(GuiceInternal guiceInternal,
                                               Binder binder,
                                               Object source)
        Internal version of Binder.withSource for establishing a trusted ElementSource chain for source-restricting bindings that are re-written using Element.applyTo(com.google.inject.Binder).

        Using Binder.withSource is not trustworthy because it's a public API that external users can use to spoof the original ElementSource of a binding by calling withSource(bogusElementSource).

      • getModule

        public static Module getModule​(Iterable<? extends Element> elements)
        Returns the module composed of elements.