Class ClassPathScanner
- java.lang.Object
-
- org.opendaylight.infrautils.inject.ClassPathScanner
-
public class ClassPathScanner extends Object
Class path scanner designed to be used with Guice. This provides a way for modules to request the bindings they need by scanning the class path.
-
-
Constructor Summary
Constructors Constructor Description ClassPathScanner(String prefix)
Create a class path scanner, scanning packages with the given prefix for @Singleton annotated classes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindAllSingletons(String prefix, BiConsumer<Class,Class> binder, Consumer<Class> singletonConsumer)
Binds allSingleton
annotated classes discovered by scanning the class path to all their interfaces.
-
-
-
Constructor Detail
-
ClassPathScanner
public ClassPathScanner(String prefix)
Create a class path scanner, scanning packages with the given prefix for @Singleton annotated classes.- Parameters:
prefix
- The package prefix.
-
-
Method Detail
-
bindAllSingletons
public void bindAllSingletons(String prefix, BiConsumer<Class,Class> binder, Consumer<Class> singletonConsumer)
Binds allSingleton
annotated classes discovered by scanning the class path to all their interfaces.- Parameters:
prefix
- the package prefix of Singleton implementations to considerbinder
- The binder (modeled as a generic consumer)
-
-