Class ConfigurationInfo
java.lang.Object
ru.vyarus.dropwizard.guice.module.context.ConfigurationInfo
Public api for collected guicey configuration info. In contrast to
ConfigurationContext,
used during configuration, contains only configuration item ids (item ids used instead of pure classes
because multiple instances of the same type could be registered (e.g. multiple bundles or modules)).
Configuration info may be used for any kind of diagnostics: configuration logging, configuration tree rendering, automatic configuration warnings generation etc.
Configuration items are stored in registration order. Information querying is implemented with help of java 8
Predicate.
Available for direct injection, but prefer accessing from
GuiceyConfigurationInfo.getData().
- Since:
- 06.07.2016
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<Class<? extends GuiceyConfigurationHook>>getHooks()<T extends ItemInfo>
TNOTE: it will not return first instance of type if called asgetInfo(ItemId.from(Bundle.class)))!Returns all registrations of type.getInfos(ConfigItem type, Predicate<T> filter) The simple way to receive a large set of info objects, instead of just ids.Used to query items of all configuration types.getItems(ConfigItem type) Pay attention that disabled (or disabled and never registered) items are also returned.getItems(ConfigItem type, Predicate<K> filter) Used to query items of one configuration type (e.g. only installers or bundles).
-
Constructor Details
-
ConfigurationInfo
Create configuration info.- Parameters:
context- configuration context
-
-
Method Details
-
getItems
Pay attention that disabled (or disabled and never registered) items are also returned.- Type Parameters:
T- expected class- Parameters:
type- configuration item type- Returns:
- registered item ids of required type in registration order or empty list if nothing registered
-
getItems
Used to query items of one configuration type (e.g. only installers or bundles). Some common filters are predefined inFilters. UsePredicate.and(Predicate),Predicate.or(Predicate)andPredicate.negate()to reuse default filters.Pay attention that disabled (or disabled and never registered) items are also returned.
- Type Parameters:
T- expected classK- expected info container class- Parameters:
type- configuration item typefilter- predicate to filter definitions- Returns:
- registered item ids in registration order, filtered with provided filter or empty list
-
getItems
Used to query items of all configuration types. May be useful to build configuration tree (e.g. to search all items configured by bundle or by classpath scan). Some common filters are predefined inFilters. UsePredicate.and(Predicate),Predicate.or(Predicate)andPredicate.negate()to reuse default filters.Pay attention that disabled (or disabled and never registered) items are also returned.
- Parameters:
filter- predicate to filter definitions- Returns:
- registered item ids in registration order, filtered with provided filter or empty list
-
getItems
- Parameters:
type- item type- Returns:
- registered items by type (possibly multiple results for instance item)
-
getInfo
NOTE: it will not return first instance of type if called asgetInfo(ItemId.from(Bundle.class)))! It could only return non null object for instance type if exact instance identity provided or disable - only info (when item was disabled but never registered then calling with idItemId.from(Bundle.class)will return disable item info (information that all instances of class are disabled)). But note, that general disable into is not created if at least one instance was registered.- Type Parameters:
T- expected configuration container type- Parameters:
id- configured item id- Returns:
- item configuration info or null if item not registered
- See Also:
-
getInfos
Returns all registrations of type. For class based extensions will return list of one element (the same result asgetInfo(ItemId.from(type))).For instance types will return all registered instances of type.- Type Parameters:
T- item info type- Parameters:
type- item class- Returns:
- all registrations of type or empty list if nothing registered
-
getInfos
The simple way to receive a large set of info objects, instead of just ids. Useful for sorting.- Type Parameters:
T- item type- Parameters:
type- required item typefilter- filter- Returns:
- all registrations matching filter or empty list if nothing registered
-
getHooks
- Returns:
- types of executed hooks
-