Class BundleSupport
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.installer.util.BundleSupport
-
public final class BundleSupport extends java.lang.Object
Utility class to work with registeredConfiguredBundle
objects within dropwizardBootstrap
object.- Since:
- 01.08.2015
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.List<T>
findBundles(io.dropwizard.core.setup.Bootstrap bootstrap, java.lang.Class<T> type)
static void
initBundles(ConfigurationContext context)
Process initialization for initially registered and all transitive bundles.static <T> java.util.List<T>
removeDuplicates(java.util.List<T> list)
Remove duplicates in list by rule: only one instance of type must be present in list.static <T> java.util.List<T>
removeTypes(java.util.List<T> list, java.util.List<java.lang.Class<? extends T>> filter)
Filter list from objects of type present in filter list.static void
runBundles(ConfigurationContext context)
Run all enabled bundles.
-
-
-
Method Detail
-
initBundles
public static void initBundles(ConfigurationContext context)
Process initialization for initially registered and all transitive bundles.- Executing initial bundles initialization (registered in
GuiceBundle
and by bundle lookup) - During execution bundles may register other bundles (through
GuiceyBootstrap
) - Execute registered bundles and repeat from previous step until no new bundles registered
- Parameters:
context
- bundles context
- Executing initial bundles initialization (registered in
-
runBundles
public static void runBundles(ConfigurationContext context) throws java.lang.Exception
Run all enabled bundles.- Parameters:
context
- bundles context- Throws:
java.lang.Exception
- if something goes wrong
-
removeDuplicates
public static <T> java.util.List<T> removeDuplicates(java.util.List<T> list)
Remove duplicates in list by rule: only one instance of type must be present in list.- Type Parameters:
T
- required bundle type- Parameters:
list
- bundles list- Returns:
- list cleared from duplicates
-
removeTypes
public static <T> java.util.List<T> removeTypes(java.util.List<T> list, java.util.List<java.lang.Class<? extends T>> filter)
Filter list from objects of type present in filter list.- Type Parameters:
T
- required type- Parameters:
list
- list to filterfilter
- types to filter- Returns:
- filtered list
-
findBundles
public static <T> java.util.List<T> findBundles(io.dropwizard.core.setup.Bootstrap bootstrap, java.lang.Class<T> type)
- Type Parameters:
T
- required bundle type- Parameters:
bootstrap
- dropwizard bootstrap instancetype
- required bundle type (or marker interface)- Returns:
- list of bundles of specified type
-
-