T
- the type of the contained objectspublic abstract class AbstractRegistry<T> extends Object implements Registry<T>
Registry
base class holding a map of all objects of the defined type.Registry.InvalidDefinitionException, Registry.NoSuchDefinitionException
Constructor and Description |
---|
AbstractRegistry()
Deprecated.
since 5.4.6, use
#AbstractRegistry(info.magnolia.module.ModuleRegistry . |
AbstractRegistry(info.magnolia.module.ModuleRegistry moduleRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
addDecorator(DefinitionDecorator<T> definitionDecorator) |
Collection<T> |
getAllDefinitions()
Returns all resolvable, valid and enabled definitions.
|
Collection<DefinitionMetadata> |
getAllMetadata() |
Collection<DefinitionProvider<T>> |
getAllProviders() |
protected DefinitionProvider<T> |
getDecoratedDefinitionProvider(DefinitionProvider<T> provider) |
DefinitionProvider<T> |
getProvider(DefinitionMetadata id)
Gets a definition provider by its complete id object.
|
DefinitionProvider<T> |
getProvider(String referenceId)
Convenience method, where the given String is what the corresponding
DefinitionMetadata.getReferenceId() would return. |
String |
getReferenceId(DefinitionReference definitionReference) |
protected RegistryMap<T> |
getRegistryMap() |
protected DefinitionProvider<T> |
onRegister(DefinitionProvider<T> provider)
This default implementation wraps the given provider when the definition is a
NamedDefinition ; in such cases,
the definition is proxied and its getName() method is intercepted and redirected to DefinitionReference.getName() . |
DefinitionQuery<T> |
query()
Implementations are expected to return a subtype of DefinitionQuery that's able to callback its registry to perform the search.
|
void |
register(DefinitionProvider<T> provider) |
void |
removeDecorator(DefinitionDecorator<T> definitionDecorator) |
void |
start()
Call start() once sources have been added; addSource() should however call source.startWith(registry) so maybe not ?
|
Set<DefinitionMetadata> |
unregisterAndRegister(Collection<DefinitionMetadata> registeredIds,
Collection<DefinitionProvider<T>> providers) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newMetadataBuilder, type
@Deprecated public AbstractRegistry()
#AbstractRegistry(info.magnolia.module.ModuleRegistry
.public AbstractRegistry(info.magnolia.module.ModuleRegistry moduleRegistry)
public void start()
Registry
protected RegistryMap<T> getRegistryMap()
public void register(DefinitionProvider<T> provider)
public Set<DefinitionMetadata> unregisterAndRegister(Collection<DefinitionMetadata> registeredIds, Collection<DefinitionProvider<T>> providers)
unregisterAndRegister
in interface Registry<T>
protected DefinitionProvider<T> onRegister(DefinitionProvider<T> provider)
NamedDefinition
; in such cases,
the definition is proxied and its getName() method is intercepted and redirected to DefinitionReference.getName()
.
Overload or override this if the provider for this registry needs to "post-process" the provider/beans being registered.
Don't forget to check DefinitionProvider.isValid()
before calling DefinitionProvider.get()
DefinitionProviderWrapper
public DefinitionProvider<T> getProvider(DefinitionMetadata id)
Registry
getProvider
in interface Registry<T>
public DefinitionProvider<T> getProvider(String referenceId)
Registry
DefinitionMetadata.getReferenceId()
would return.getProvider
in interface Registry<T>
DefinitionMetadata.getReferenceId()
protected final DefinitionProvider<T> getDecoratedDefinitionProvider(DefinitionProvider<T> provider)
public Collection<DefinitionProvider<T>> getAllProviders()
getAllProviders
in interface Registry<T>
public Collection<DefinitionMetadata> getAllMetadata()
getAllMetadata
in interface Registry<T>
public Collection<T> getAllDefinitions()
Registry
getAllDefinitions
in interface Registry<T>
public DefinitionQuery<T> query()
Registry
public void addDecorator(DefinitionDecorator<T> definitionDecorator)
addDecorator
in interface Registry<T>
public void removeDecorator(DefinitionDecorator<T> definitionDecorator)
removeDecorator
in interface Registry<T>
public String getReferenceId(DefinitionReference definitionReference)
getReferenceId
in interface DefinitionReferenceIdResolver
Copyright © 2003–2016 Magnolia International Ltd.. All rights reserved.