Class AbstractMergeableElementList
java.lang.Object
org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
org.codehaus.plexus.metadata.merge.support.AbstractMergeableElement
org.codehaus.plexus.metadata.merge.support.AbstractMergeableElementList
- All Implemented Interfaces:
Mergeable
- Direct Known Subclasses:
ComponentsElement
,RequirementsElement
Base class that allows for handling merging two element lists.
TODO Refactor and make this extend AbstractMergeableElement
which is what
this actually is, but with added bits for merging child element lists.
- Author:
- Rahul Thakur
-
Field Summary
Fields inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
element
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract List
getElementNamesForConflictResolution
(List defaultList) Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.protected abstract String
Allows the sub classes to provided a tag name that they expect to recurr within them.void
Merges an element of same type.protected void
Identifies the conflicting elements in the dominant and recessiveMap
instance and merges as required.protected Map
parseRecurringMergeables
(String tagName, List compositeKeyList, Mergeable parentElement) Parses <component> elements and builds a map keyed basd on the list of composite keys specified.Methods inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableElement
isRecessiveElementInConflict, isRecessiveElementInConflict, merge, mergeableElementComesFromRecessive
Methods inherited from class org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
addContent, addContent, addContent, addContent, addContent, addNamespaceDeclaration, clone, cloneContent, detach, equals, getAdditionalNamespaces, getAttribute, getAttribute, getAttributes, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValue, getChild, getChild, getChildren, getChildren, getChildren, getChildText, getChildText, getChildTextNormalize, getChildTextNormalize, getChildTextTrim, getChildTextTrim, getContent, getContent, getContent, getContentSize, getDefaultMergeStrategy, getDescendants, getDescendants, getDocument, getElement, getName, getNamespace, getNamespace, getNamespacePrefix, getNamespaceURI, getParent, getParentElement, getQualifiedName, getText, getTextNormalize, getTextTrim, getValue, hashCode, indexOf, isAncestor, isExpectedElementType, isRootElement, removeAttribute, removeAttribute, removeAttribute, removeChild, removeChild, removeChildren, removeChildren, removeContent, removeContent, removeContent, removeContent, removeNamespaceDeclaration, setAttribute, setAttribute, setAttribute, setAttributes, setContent, setContent, setContent, setContent, setName, setNamespace, setText, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.codehaus.plexus.metadata.merge.support.Mergeable
getAllowedTags
-
Constructor Details
-
AbstractMergeableElementList
public AbstractMergeableElementList(org.jdom2.Element element)
-
-
Method Details
-
parseRecurringMergeables
protected Map parseRecurringMergeables(String tagName, List compositeKeyList, Mergeable parentElement) throws Exception Parses <component> elements and builds a map keyed basd on the list of composite keys specified.- Parameters:
tagName
- Name of the tag that appears multiple timescompositeKeyList
- List of element/tag names to be used as composite keys to register recurringMergeable
instances.parentElement
-Mergeable
.- Returns:
- Map of
Mergeable
instances keyed on the composite key obtained fromgetElementNamesForConflictResolution(java.util.List)
- Throws:
Exception
- if there was an error parsing and registeringMergeable
instances
-
merge
Description copied from class:AbstractMergeableSupport
Merges an element of same type.- Specified by:
merge
in interfaceMergeable
- Overrides:
merge
in classAbstractMergeableElement
- Parameters:
me
- Another entity that is mergeable.- Throws:
MergeException
- if there was an error merging the mergeables.
-
merge
Identifies the conflicting elements in the dominant and recessiveMap
instance and merges as required.- Parameters:
parent
-Element
that is parent for the children in the dominant Map instance. Merged content is added to this element.dMap
- Dominant Map keyed by the composite key obtained fromgetElementNamesForConflictResolution(List)
rMap
- Recessive Map keyed by the composite key obtained fromgetElementNamesForConflictResolution(List)
- Throws:
Exception
- if there was an error merging both the maps.
-
getTagNameForRecurringMergeable
Allows the sub classes to provided a tag name that they expect to recurr within them. For instance:- <components> expects <component> to recurr within itself.
- <requirements> expects <requirement> to recurr within itself.
- Returns:
- tag name of the
Mergeable
element that occurs multiple times.
-
getElementNamesForConflictResolution
Description copied from class:AbstractMergeableSupport
Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.- Overrides:
getElementNamesForConflictResolution
in classAbstractMergeableSupport
- Parameters:
defaultList
- the default list.- Returns:
- the default list.
-