org.codehaus.plexus.metadata.merge.support

## Class AbstractMergeableSupport

- java.lang.Object
- - org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport

All Implemented Interfaces:
  Mergeable

Direct Known Subclasses:
  AbstractMergeableElement

    public abstract class AbstractMergeableSupport
    extends java.lang.Object
    implements Mergeable

Version:
  $Id: AbstractMergeableSupport.java 7689 2008-08-23 16:09:20Z jvanzyl $
Author:
  Rahul Thakur

### Field Summary

Fields
`protected org.jdom.Element` `element` Wrapped JDOM element.

### Constructor Summary

Constructors
Constructor and Description
`AbstractMergeableSupport(org.jdom.Element element)`

### Method Summary

Methods
`org.jdom.Element` `addContent(java.util.Collection collection)`
`org.jdom.Element` `addContent(org.jdom.Content child)`
`org.jdom.Element` `addContent(int index, java.util.Collection c)`
`org.jdom.Element` `addContent(int index, org.jdom.Content child)`
`org.jdom.Element` `addContent(java.lang.String str)`
`void` `addNamespaceDeclaration(org.jdom.Namespace additional)`
`java.lang.Object` `clone()`
`java.util.List` `cloneContent()`
`org.jdom.Content` `detach()`
`boolean` `equals(java.lang.Object obj)`
`java.util.List` `getAdditionalNamespaces()`
`org.jdom.Attribute` `getAttribute(java.lang.String name)`
`org.jdom.Attribute` `getAttribute(java.lang.String name, org.jdom.Namespace ns)`
`java.util.List` `getAttributes()`
`java.lang.String` `getAttributeValue(java.lang.String name)`
`java.lang.String` `getAttributeValue(java.lang.String name, org.jdom.Namespace ns)`
`java.lang.String` `getAttributeValue(java.lang.String name, org.jdom.Namespace ns, java.lang.String def)`
`java.lang.String` `getAttributeValue(java.lang.String name, java.lang.String def)`
`org.jdom.Element` `getChild(java.lang.String name)`
`org.jdom.Element` `getChild(java.lang.String name, org.jdom.Namespace ns)`
`java.util.List` `getChildren()`
`java.util.List` `getChildren(java.lang.String name)`
`java.util.List` `getChildren(java.lang.String name, org.jdom.Namespace ns)`
`java.lang.String` `getChildText(java.lang.String name)`
`java.lang.String` `getChildText(java.lang.String name, org.jdom.Namespace ns)`
`java.lang.String` `getChildTextNormalize(java.lang.String name)`
`java.lang.String` `getChildTextNormalize(java.lang.String name, org.jdom.Namespace ns)`
`java.lang.String` `getChildTextTrim(java.lang.String name)`
`java.lang.String` `getChildTextTrim(java.lang.String name, org.jdom.Namespace ns)`
`java.util.List` `getContent()`
`java.util.List` `getContent(org.jdom.filter.Filter filter)`
`org.jdom.Content` `getContent(int index)`
`int` `getContentSize()`
`protected MergeStrategy` `getDefaultMergeStrategy()` Returns the default `MergeStrategy` instance.
`java.util.Iterator` `getDescendants()`
`java.util.Iterator` `getDescendants(org.jdom.filter.Filter filter)`
`org.jdom.Document` `getDocument()`
`org.jdom.Element` `getElement()` Returns the wrapped up JDom `Element` instance.
`protected java.util.List` `getElementNamesForConflictResolution(java.util.List defaultList)` Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.
`java.lang.String` `getName()`
`org.jdom.Namespace` `getNamespace()`
`org.jdom.Namespace` `getNamespace(java.lang.String prefix)`
`java.lang.String` `getNamespacePrefix()`
`java.lang.String` `getNamespaceURI()`
`org.jdom.Parent` `getParent()`
`org.jdom.Element` `getParentElement()`
`java.lang.String` `getQualifiedName()`
`java.lang.String` `getText()`
`java.lang.String` `getTextNormalize()`
`java.lang.String` `getTextTrim()`
`java.lang.String` `getValue()`
`int` `hashCode()`
`int` `indexOf(org.jdom.Content child)`
`boolean` `isAncestor(org.jdom.Element element)`
`protected abstract boolean` `isExpectedElementType(Mergeable me)` Determines if the passed in `Mergeable` was of same type as this class.
`boolean` `isRootElement()`
`abstract void` `merge(Mergeable me)` Merges an element of same type.
`boolean` `removeAttribute(org.jdom.Attribute attribute)`
`boolean` `removeAttribute(java.lang.String name)`
`boolean` `removeAttribute(java.lang.String name, org.jdom.Namespace ns)`
`boolean` `removeChild(java.lang.String name)`
`boolean` `removeChild(java.lang.String name, org.jdom.Namespace ns)`
`boolean` `removeChildren(java.lang.String name)`
`boolean` `removeChildren(java.lang.String name, org.jdom.Namespace ns)`
`java.util.List` `removeContent()`
`boolean` `removeContent(org.jdom.Content child)`
`java.util.List` `removeContent(org.jdom.filter.Filter filter)`
`org.jdom.Content` `removeContent(int index)`
`void` `removeNamespaceDeclaration(org.jdom.Namespace additionalNamespace)`
`org.jdom.Element` `setAttribute(org.jdom.Attribute attribute)`
`org.jdom.Element` `setAttribute(java.lang.String name, java.lang.String value)`
`org.jdom.Element` `setAttribute(java.lang.String name, java.lang.String value, org.jdom.Namespace ns)`
`org.jdom.Element` `setAttributes(java.util.List newAttributes)`
`org.jdom.Element` `setContent(java.util.Collection newContent)`
`org.jdom.Element` `setContent(org.jdom.Content child)`
`org.jdom.Parent` `setContent(int index, java.util.Collection collection)`
`org.jdom.Element` `setContent(int index, org.jdom.Content child)`
`org.jdom.Element` `setName(java.lang.String name)`
`org.jdom.Element` `setNamespace(org.jdom.Namespace namespace)`
`org.jdom.Element` `setText(java.lang.String text)`
`java.lang.String` `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, merge`

### Field Detail

#### element

    protected org.jdom.Element element

Wrapped JDOM element.

### Constructor Detail

#### AbstractMergeableSupport

    public AbstractMergeableSupport(org.jdom.Element element)

### Method Detail

#### merge

    public abstract void merge(Mergeable me)
                        throws MergeException

Description copied from interface: `Mergeable`
Merges an element of same type.

Specified by:
  `merge` in interface `Mergeable`
Parameters:
  `me` - Another entity that is mergeable.
Throws:
  `MergeException` - if there was an error merging the mergeables.

#### isExpectedElementType

    protected abstract boolean isExpectedElementType(Mergeable me)

Determines if the passed in `Mergeable` was of same type as this class.

Parameters:
  `me` - `Mergeable` instance to test.
Returns:
  `true` if the passed in Mergeable can be merged with the current Mergeable.

#### addContent

    public org.jdom.Element addContent(java.util.Collection collection)

#### addContent

    public org.jdom.Element addContent(org.jdom.Content child)

#### addContent

    public org.jdom.Element addContent(int index,
                              java.util.Collection c)

#### addContent

    public org.jdom.Element addContent(int index,
                              org.jdom.Content child)

#### addContent

    public org.jdom.Element addContent(java.lang.String str)

#### addNamespaceDeclaration

    public void addNamespaceDeclaration(org.jdom.Namespace additional)

#### clone

    public java.lang.Object clone()

Overrides:
  `clone` in class `java.lang.Object`

#### cloneContent

    public java.util.List cloneContent()

#### detach

    public org.jdom.Content detach()

#### equals

    public boolean equals(java.lang.Object obj)

Overrides:
  `equals` in class `java.lang.Object`

#### getAdditionalNamespaces

    public java.util.List getAdditionalNamespaces()

#### getAttribute

    public org.jdom.Attribute getAttribute(java.lang.String name,
                                  org.jdom.Namespace ns)

#### getAttribute

    public org.jdom.Attribute getAttribute(java.lang.String name)

#### getAttributes

    public java.util.List getAttributes()

#### getAttributeValue

    public java.lang.String getAttributeValue(java.lang.String name,
                                     org.jdom.Namespace ns,
                                     java.lang.String def)

See Also:
  `Element.getAttributeValue(java.lang.String,org.jdom.Namespace,java.lang.String)`

#### getAttributeValue

    public java.lang.String getAttributeValue(java.lang.String name,
                                     org.jdom.Namespace ns)

See Also:
  `Element.getAttributeValue(java.lang.String,org.jdom.Namespace)`

#### getAttributeValue

    public java.lang.String getAttributeValue(java.lang.String name,
                                     java.lang.String def)

See Also:
  `Element.getAttributeValue(java.lang.String,java.lang.String)`

#### getAttributeValue

    public java.lang.String getAttributeValue(java.lang.String name)

See Also:
  `Element.getAttributeValue(java.lang.String)`

#### getChild

    public org.jdom.Element getChild(java.lang.String name,
                            org.jdom.Namespace ns)

Returns:
See Also:
  `Element.getChild(java.lang.String,org.jdom.Namespace)`

#### getChild

    public org.jdom.Element getChild(java.lang.String name)

See Also:
  `Element.getChild(java.lang.String)`

#### getChildren

    public java.util.List getChildren()

See Also:
  `Element.getChildren()`

#### getChildren

    public java.util.List getChildren(java.lang.String name,
                             org.jdom.Namespace ns)

See Also:
  `Element.getChildren(java.lang.String,org.jdom.Namespace)`

#### getChildren

    public java.util.List getChildren(java.lang.String name)

See Also:
  `Element.getChildren(java.lang.String)`

#### getChildText

    public java.lang.String getChildText(java.lang.String name,
                                org.jdom.Namespace ns)

See Also:
  `Element.getChildText(java.lang.String,org.jdom.Namespace)`

#### getChildText

    public java.lang.String getChildText(java.lang.String name)

See Also:
  `Element.getChildText(java.lang.String)`

#### getChildTextNormalize

    public java.lang.String getChildTextNormalize(java.lang.String name,
                                         org.jdom.Namespace ns)

See Also:
  `Element.getChildTextNormalize(java.lang.String,org.jdom.Namespace)`

#### getChildTextNormalize

    public java.lang.String getChildTextNormalize(java.lang.String name)

See Also:
  `Element.getChildTextNormalize(java.lang.String)`

#### getChildTextTrim

    public java.lang.String getChildTextTrim(java.lang.String name,
                                    org.jdom.Namespace ns)

See Also:
  `Element.getChildTextTrim(java.lang.String,org.jdom.Namespace)`

#### getChildTextTrim

    public java.lang.String getChildTextTrim(java.lang.String name)

See Also:
  `Element.getChildTextTrim(java.lang.String)`

#### getContent

    public java.util.List getContent()

See Also:
  `Element.getContent()`

#### getContent

    public java.util.List getContent(org.jdom.filter.Filter filter)

See Also:
  `Element.getContent(org.jdom.filter.Filter)`

#### getContent

    public org.jdom.Content getContent(int index)

See Also:
  `Element.getContent(int)`

#### getContentSize

    public int getContentSize()

Returns:
See Also:
  `Element.getContentSize()`

#### getDescendants

    public java.util.Iterator getDescendants()

See Also:
  `Element.getDescendants()`

#### getDescendants

    public java.util.Iterator getDescendants(org.jdom.filter.Filter filter)

See Also:
  `Element.getDescendants(org.jdom.filter.Filter)`

#### getDocument

    public org.jdom.Document getDocument()

See Also:
  `Content.getDocument()`

#### getName

    public java.lang.String getName()

See Also:
  `Element.getName()`

#### getNamespace

    public org.jdom.Namespace getNamespace()

See Also:
  `Element.getNamespace()`

#### getNamespace

    public org.jdom.Namespace getNamespace(java.lang.String prefix)

See Also:
  `Element.getNamespace(java.lang.String)`

#### getNamespacePrefix

    public java.lang.String getNamespacePrefix()

See Also:
  `Element.getNamespacePrefix()`

#### getNamespaceURI

    public java.lang.String getNamespaceURI()

See Also:
  `Element.getNamespaceURI()`

#### getParent

    public org.jdom.Parent getParent()

See Also:
  `Content.getParent()`

#### getParentElement

    public org.jdom.Element getParentElement()

See Also:
  `Content.getParentElement()`

#### getQualifiedName

    public java.lang.String getQualifiedName()

See Also:
  `Element.getQualifiedName()`

#### getText

    public java.lang.String getText()

See Also:
  `Element.getText()`

#### getTextNormalize

    public java.lang.String getTextNormalize()

See Also:
  `Element.getTextNormalize()`

#### getTextTrim

    public java.lang.String getTextTrim()

See Also:
  `Element.getTextTrim()`

#### getValue

    public java.lang.String getValue()

See Also:
  `Element.getValue()`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`
See Also:
  `Object.hashCode()`

#### indexOf

    public int indexOf(org.jdom.Content child)

See Also:
  `Element.indexOf(org.jdom.Content)`

#### isAncestor

    public boolean isAncestor(org.jdom.Element element)

See Also:
  `Element.isAncestor(org.jdom.Element)`

#### isRootElement

    public boolean isRootElement()

See Also:
  `Element.isRootElement()`

#### removeAttribute

    public boolean removeAttribute(org.jdom.Attribute attribute)

See Also:
  `Element.removeAttribute(org.jdom.Attribute)`

#### removeAttribute

    public boolean removeAttribute(java.lang.String name,
                          org.jdom.Namespace ns)

See Also:
  `Element.removeAttribute(java.lang.String,org.jdom.Namespace)`

#### removeAttribute

    public boolean removeAttribute(java.lang.String name)

See Also:
  `Element.removeAttribute(java.lang.String)`

#### removeChild

    public boolean removeChild(java.lang.String name,
                      org.jdom.Namespace ns)

See Also:
  `Element.removeChild(java.lang.String,org.jdom.Namespace)`

#### removeChild

    public boolean removeChild(java.lang.String name)

See Also:
  `Element.removeChild(java.lang.String)`

#### removeChildren

    public boolean removeChildren(java.lang.String name,
                         org.jdom.Namespace ns)

See Also:
  `Element.removeChildren(java.lang.String,org.jdom.Namespace)`

#### removeChildren

    public boolean removeChildren(java.lang.String name)

See Also:
  `Element.removeChildren(java.lang.String)`

#### removeContent

    public java.util.List removeContent()

See Also:
  `Element.removeContent()`

#### removeContent

    public boolean removeContent(org.jdom.Content child)

See Also:
  `Element.removeContent(org.jdom.Content)`

#### removeContent

    public java.util.List removeContent(org.jdom.filter.Filter filter)

See Also:
  `Element.removeContent(org.jdom.filter.Filter)`

#### removeContent

    public org.jdom.Content removeContent(int index)

See Also:
  `Element.removeContent(int)`

#### removeNamespaceDeclaration

    public void removeNamespaceDeclaration(org.jdom.Namespace additionalNamespace)

See Also:
  `Element.removeNamespaceDeclaration(org.jdom.Namespace)`

#### setAttribute

    public org.jdom.Element setAttribute(org.jdom.Attribute attribute)

See Also:
  `Element.setAttribute(org.jdom.Attribute)`

#### setAttribute

    public org.jdom.Element setAttribute(java.lang.String name,
                                java.lang.String value,
                                org.jdom.Namespace ns)

See Also:
  `Element.setAttribute(java.lang.String,java.lang.String,org.jdom.Namespace)`

#### setAttribute

    public org.jdom.Element setAttribute(java.lang.String name,
                                java.lang.String value)

See Also:
  `Element.setAttribute(java.lang.String,java.lang.String)`

#### setAttributes

    public org.jdom.Element setAttributes(java.util.List newAttributes)

See Also:
  `Element.setAttributes(java.util.List)`

#### setContent

    public org.jdom.Element setContent(java.util.Collection newContent)

See Also:
  `Element.setContent(java.util.Collection)`

#### setContent

    public org.jdom.Element setContent(org.jdom.Content child)

See Also:
  `Element.setContent(org.jdom.Content)`

#### setContent

    public org.jdom.Parent setContent(int index,
                             java.util.Collection collection)

See Also:
  `Element.setContent(int,java.util.Collection)`

#### setContent

    public org.jdom.Element setContent(int index,
                              org.jdom.Content child)

See Also:
  `Element.setContent(int,org.jdom.Content)`

#### setName

    public org.jdom.Element setName(java.lang.String name)

See Also:
  `Element.setName(java.lang.String)`

#### setNamespace

    public org.jdom.Element setNamespace(org.jdom.Namespace namespace)

See Also:
  `Element.setNamespace(org.jdom.Namespace)`

#### setText

    public org.jdom.Element setText(java.lang.String text)

See Also:
  `Element.setText(java.lang.String)`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`
See Also:
  `Element.toString()`

#### getElement

    public org.jdom.Element getElement()

Returns the wrapped up JDom `Element` instance.

Specified by:
  `getElement` in interface `Mergeable`
Returns:
  the wrapped up JDom `Element` instance.

#### getElementNamesForConflictResolution

    protected java.util.List getElementNamesForConflictResolution(java.util.List defaultList)

Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.

#### getDefaultMergeStrategy

    protected MergeStrategy getDefaultMergeStrategy()

Returns the default `MergeStrategy` instance.