public final class ConfigurationInfo
extends java.lang.Object
ConfigurationContext,
used during configuration, contains only configuration item ids (item ids used instead of pure classes
because multiple instances of teh 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().
as high level info api,
for the list of available confiugration items| Constructor and Description |
|---|
ConfigurationInfo(ConfigurationContext context) |
| Modifier and Type | Method and Description |
|---|---|
<T extends ItemInfo> |
getInfo(ItemId id)
NOTE: it will not return first instance of type if called as
getInfo(ItemId.from(Bundle.class)))! |
<T extends ItemInfo> |
getInfos(java.lang.Class<?> type)
Returns all registrations of type.
|
java.util.List<ItemId<java.lang.Object>> |
getItems(java.lang.Class<?> type) |
<T> java.util.List<ItemId<T>> |
getItems(ConfigItem type)
Pay attention that disabled (or disabled and never registered) items are also returned.
|
<T,K extends ItemInfo> |
getItems(ConfigItem type,
java.util.function.Predicate<K> filter)
Used to query items of one configuration type (e.g. only installers or bundles).
|
java.util.List<ItemId<java.lang.Object>> |
getItems(java.util.function.Predicate<? extends ItemInfo> filter)
Used to query items of all configuration types.
|
public ConfigurationInfo(ConfigurationContext context)
public <T> java.util.List<ItemId<T>> getItems(ConfigItem type)
T - expected classtype - configuration item typepublic <T,K extends ItemInfo> java.util.List<ItemId<T>> getItems(ConfigItem type, java.util.function.Predicate<K> filter)
Filters. Use Predicate.and(Predicate), Predicate.or(Predicate)
and Predicate.negate() to reuse default filters.
Pay attention that disabled (or disabled and never registered) items are also returned.
T - expected classK - expected info container classtype - configuration item typefilter - predicate to filter definitionspublic java.util.List<ItemId<java.lang.Object>> getItems(java.util.function.Predicate<? extends ItemInfo> filter)
Filters. Use Predicate.and(Predicate), Predicate.or(Predicate)
and Predicate.negate() to reuse default filters.
Pay attention that disabled (or disabled and never registered) items are also returned.
filter - predicate to filter definitionspublic java.util.List<ItemId<java.lang.Object>> getItems(java.lang.Class<?> type)
type - item typepublic <T extends ItemInfo> T getInfo(ItemId id)
getInfo(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 id
ItemId.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.T - expected configuration container typeid - configured item idto retrieve all instace items of typepublic <T extends ItemInfo> java.util.List<T> getInfos(java.lang.Class<?> type)
getInfo(ItemId.from(type))).For instance types will return all registered instances of type.T - item info typetype - item class