Interface ItemInfo
-
- All Known Subinterfaces:
BundleItemInfo<T>
,ClassItemInfo
,CommandItemInfo
,DropwizardBundleItemInfo
,ExtensionItemInfo
,GuiceyBundleItemInfo
,InstallerItemInfo
,InstanceItemInfo<T>
,ModuleItemInfo
- All Known Implementing Classes:
BundleItemInfoImpl
,ClassItemInfoImpl
,CommandItemInfoImpl
,DropwizardBundleItemInfoImpl
,ExtensionItemInfoImpl
,GuiceyBundleItemInfoImpl
,InstallerItemInfoImpl
,InstanceItemInfoImpl
,ItemInfoImpl
,ModuleItemInfoImpl
public interface ItemInfo
Base interface for item info objects. Combines common signs for all configuration items. Items may be registered by application (direct registration throughGuiceBundle
, by classpath scan or byGuiceyBundle
.Multiple sources may register single item and even the same source could register it multiple times. Each entity will be actually registered once, but information about all registrations is stored and may be used for warnings reporting.
- Since:
- 09.07.2016
- See Also:
for list of available items
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ItemId
getId()
Items could be registered by class and by instance.int
getIgnoresByScope(java.lang.Class<?> scope)
Shortcut forgetIgnoresByScope(ItemId)
.int
getIgnoresByScope(ItemId scope)
Required to show ignored items in the same scope as actual registration.ConfigItem
getItemType()
java.util.Set<ItemId>
getRegisteredBy()
Configuration items may be registered by root application class, classpath scan or guicey bundle.int
getRegistrationAttempts()
It may be 0 for disabled items (e.g. installer disabled but never registered).ItemId
getRegistrationScope()
Item may be registered multiple times.ConfigScope
getRegistrationScopeType()
It is essentially the same asgetRegistrationScope()
, but with generified guicey bundle scope.java.lang.Class<?>
getType()
boolean
isRegistered()
Useful to recognize not registered info items appeared for example because of item disabling.boolean
isRegisteredDirectly()
-
-
-
Method Detail
-
getId
ItemId getId()
Items could be registered by class and by instance. In case of instance registration, multiple instances could be provided with the same class. For class registrations item id is equal to pure class.- Returns:
- item identity
-
getItemType
ConfigItem getItemType()
- Returns:
- configuration item type (e.g. installer, bundle, extension etc)
-
getType
java.lang.Class<?> getType()
- Returns:
- actual item class
-
getRegisteredBy
java.util.Set<ItemId> getRegisteredBy()
Configuration items may be registered by root application class, classpath scan or guicey bundle. For registrations in application classApplication
is stored as context. For registration by classpath scanClasspathScanner
is stored as context. For registrations byGuiceyBundle
, actual bundle class is stored as context. Bundle items may also haveGuiceyBundleLookup
as context classe for bundles resolved by lookup mechanism.May not contain elements if item was never registered, but for example, disabled.
To quick check if exact scope class is present use
ItemId.from(class)
, which will match any class instance related scope key.- Returns:
- context classes which register item or empty collection
- See Also:
for the list of all special scopes
-
getRegistrationScope
ItemId getRegistrationScope()
Item may be registered multiple times. For class items (e.g. extension) only first scope will be actual registration scope (and registrations from other scopes will be simply ignored). For instance items (bundle, module), different objects of the same type will be registered according toDuplicateConfigDetector
).May be null for never registered but disabled items!
- Returns:
- registration scope
- See Also:
for all scopes performing registratoin
-
getRegistrationScopeType
ConfigScope getRegistrationScopeType()
It is essentially the same asgetRegistrationScope()
, but with generified guicey bundle scope. May be useful for generic reporting.- Returns:
- type of registration scope
-
getRegistrationAttempts
int getRegistrationAttempts()
It may be 0 for disabled items (e.g. installer disabled but never registered). Also, count may be greater than registration sources count, because the same source could register item multiple times.- Returns:
- count of item registrations
-
isRegistered
boolean isRegistered()
Useful to recognize not registered info items appeared for example because of item disabling.- Returns:
- true if item was registered, false otherwise
-
isRegisteredDirectly
boolean isRegisteredDirectly()
- Returns:
- true if item directly registered through
GuiceBundle.Builder
, false otherwise.
-
getIgnoresByScope
int getIgnoresByScope(ItemId scope)
Required to show ignored items in the same scope as actual registration.When checked bundles by class only item (
ItemId.from(Bundle.class)
) it wil return sum of registrations for all instances of type.- Parameters:
scope
- scope- Returns:
- number of ignored items in scope
-
getIgnoresByScope
int getIgnoresByScope(java.lang.Class<?> scope)
Shortcut forgetIgnoresByScope(ItemId)
.- Parameters:
scope
- scope type to check ignores- Returns:
- number of ignored items in all scopes of specified type
-
-