public abstract class SimpleContributionRegistry<T> extends ContributionFragmentRegistry<T>
ContributionFragmentRegistry.Fragment<T>, ContributionFragmentRegistry.FragmentList<T>
Modifier and Type | Field and Description |
---|---|
protected Map<String,T> |
currentContribs |
contribs
Constructor and Description |
---|
SimpleContributionRegistry() |
Modifier and Type | Method and Description |
---|---|
T |
clone(T orig)
CLone the given contribution object
|
void |
contributionRemoved(String id,
T origContrib)
All the fragments in the contribution was removed.
|
void |
contributionUpdated(String id,
T contrib,
T newOrigContrib)
Adds or updates a contribution.
|
protected T |
getCurrentContribution(String id) |
boolean |
isSupportingMerge()
Returns true if merge is supported.
|
void |
merge(T src,
T dst)
Merge 'src' into 'dst'.
|
addContribution, addFragment, getContribution, getContributionId, getFragments, removeContribution, removeContribution, removeFragment, toMap
protected Map<String,T> currentContribs
public SimpleContributionRegistry()
public void contributionUpdated(String id, T contrib, T newOrigContrib)
ContributionFragmentRegistry
If the contribution doesn't yet exists then it will be added, otherwise the value will be updated. If the given value is null the existing contribution must be removed.
The second parameter is the contribution that should be updated when merging, as well as stored and used. This
usually represents a clone of the original contribution or a merge of multiple contribution fragments.
Modifications on this object at application level will be lost on next
ContributionFragmentRegistry.contributionUpdated(String, Object, Object)
call on the same object id: modifications should be done in
the ContributionFragmentRegistry.merge(Object, Object)
method.
The last parameter is the new contribution object, unchanged (original) which was neither cloned nor merged. This object should never be modified at application level, because it will be used each time a subsequent merge is done. Also, it never should be stored.
contributionUpdated
in class ContributionFragmentRegistry<T>
id
- - the id of the contribution that needs to be updatedcontrib
- the updated contribution object thatnewOrigContrib
- - the new, unchanged (original) contribution fragment that triggered the update.public void contributionRemoved(String id, T origContrib)
ContributionFragmentRegistry
The first parameter is the contribution ID that should be remove and the second parameter the original contribution fragment that as unregistered causing the contribution to be removed.
contributionRemoved
in class ContributionFragmentRegistry<T>
public boolean isSupportingMerge()
ContributionFragmentRegistry
Hook method to be overridden if merge logics behind Object.clone()
and ContributionFragmentRegistry.merge(Object, Object)
cannot be
implemented.
isSupportingMerge
in class ContributionFragmentRegistry<T>
public T clone(T orig)
ContributionFragmentRegistry
clone
in class ContributionFragmentRegistry<T>
public void merge(T src, T dst)
ContributionFragmentRegistry
merge
in class ContributionFragmentRegistry<T>
src
- the object to copy over the 'dst' objectdst
- this object is modifiedprotected T getCurrentContribution(String id)
Copyright © 2018 Nuxeo. All rights reserved.