public class GuiceSpi extends Object
Current utility allows to traverse and inspect the elements
and bindings
with Java 8 lambdas and streams.
Modifier and Type | Class and Description |
---|---|
static class |
GuiceSpi.BindingVisitor<R>
Wraps
DefaultBindingTargetVisitor class into a lambda-friendly fluent API. |
Constructor and Description |
---|
GuiceSpi() |
Modifier and Type | Method and Description |
---|---|
static <T> Optional<com.google.inject.Binding<T>> |
findBinding(Collection<com.google.inject.spi.Element> elements,
com.google.inject.Key<T> key) |
static Stream<com.google.inject.Binding> |
getBindings(Collection<com.google.inject.spi.Element> elements)
Takes a collection of
elements and presents it
a stream of bindings skipping all the elements
that are not bindings on the way. |
static <R> GuiceSpi.BindingVisitor<R> |
inspect(com.google.inject.Binding<?> binding)
Shortcut provider of
GuiceSpi.BindingVisitor instance. |
static <T> Class<? super T> |
rawType(com.google.inject.Key<T> key) |
static com.google.inject.internal.Scoping |
resolveScope(com.google.inject.Binding<?> currentBinding)
Resolves the
scoping information of
the binding . |
public static Stream<com.google.inject.Binding> getBindings(Collection<com.google.inject.spi.Element> elements)
elements
and presents it
a stream of bindings
skipping all the elements
that are not bindings on the way. This method is useful since
most of the time when we are processing the Guice module elements
we are only interested in bindings.public static <T> Optional<com.google.inject.Binding<T>> findBinding(Collection<com.google.inject.spi.Element> elements, com.google.inject.Key<T> key)
public static <T> Class<? super T> rawType(com.google.inject.Key<T> key)
public static com.google.inject.internal.Scoping resolveScope(com.google.inject.Binding<?> currentBinding)
scoping
information of
the binding
.public static <R> GuiceSpi.BindingVisitor<R> inspect(com.google.inject.Binding<?> binding)
GuiceSpi.BindingVisitor
instance.Copyright © 2020 Magnolia International Ltd.. All rights reserved.