T
- the type of the contained objectspublic class RegistryMap<T> extends Object
removeAndPutAll
that is
used to remove a set of previously added values before adding a collection of new ones. Read operations are blocked
until it completes guaranteeing proper visibility.
It is common for entities in registries to also hold their identifier. The method keyFormValue
can be
overridden to get the identifier from the value. This removes the need to package a set of entities that should be
added in a Map before calling removeAndPutAll(java.util.Collection, java.util.Collection)
.
This is a port and simplified version of info.magnolia.registry.RegistryMap
, which was written prior to the
introduction of the Registry
interface. It should not be used directly.Constructor and Description |
---|
RegistryMap() |
Modifier and Type | Method and Description |
---|---|
protected String |
asStringKey(DefinitionProvider<T> provider) |
DefinitionProvider<T> |
get(DefinitionMetadata key) |
DefinitionProvider<T> |
getByStringKey(String stringKey) |
DefinitionProvider<T> |
getRequired(DefinitionMetadata key) |
DefinitionProvider<T> |
getRequiredByStringKey(String stringKey) |
protected DefinitionMetadata |
keyFromValue(DefinitionProvider<T> provider) |
Collection<DefinitionMetadata> |
keySet() |
DefinitionMetadata |
put(DefinitionProvider<T> value) |
void |
remove(DefinitionMetadata key) |
Set<DefinitionMetadata> |
removeAndPutAll(Collection<DefinitionMetadata> toRemove,
Collection<DefinitionProvider<T>> toPut) |
Collection<DefinitionProvider<T>> |
values() |
public DefinitionProvider<T> get(DefinitionMetadata key)
public DefinitionProvider<T> getByStringKey(String stringKey)
public DefinitionProvider<T> getRequired(DefinitionMetadata key) throws RegistrationException
RegistrationException
public DefinitionProvider<T> getRequiredByStringKey(String stringKey) throws RegistrationException
RegistrationException
public DefinitionMetadata put(DefinitionProvider<T> value)
public void remove(DefinitionMetadata key)
public Set<DefinitionMetadata> removeAndPutAll(Collection<DefinitionMetadata> toRemove, Collection<DefinitionProvider<T>> toPut)
public Collection<DefinitionMetadata> keySet()
public Collection<DefinitionProvider<T>> values()
protected DefinitionMetadata keyFromValue(DefinitionProvider<T> provider)
protected String asStringKey(DefinitionProvider<T> provider)
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.