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 Object implements Mergeable
- Author:
- khmarbaise
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jdom2.ElementelementWrapped JDOM element.
-
Constructor Summary
Constructors Constructor Description AbstractMergeableSupport(org.jdom2.Element element)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.jdom2.ElementaddContent(int index, Collection c)org.jdom2.ElementaddContent(int index, org.jdom2.Content child)org.jdom2.ElementaddContent(String str)org.jdom2.ElementaddContent(Collection collection)org.jdom2.ElementaddContent(org.jdom2.Content child)voidaddNamespaceDeclaration(org.jdom2.Namespace additional)Objectclone()ListcloneContent()org.jdom2.Contentdetach()booleanequals(Object obj)ListgetAdditionalNamespaces()org.jdom2.AttributegetAttribute(String name)org.jdom2.AttributegetAttribute(String name, org.jdom2.Namespace ns)ListgetAttributes()StringgetAttributeValue(String name)StringgetAttributeValue(String name, String def)StringgetAttributeValue(String name, org.jdom2.Namespace ns)StringgetAttributeValue(String name, org.jdom2.Namespace ns, String def)org.jdom2.ElementgetChild(String name)org.jdom2.ElementgetChild(String name, org.jdom2.Namespace ns)ListgetChildren()ListgetChildren(String name)ListgetChildren(String name, org.jdom2.Namespace ns)StringgetChildText(String name)StringgetChildText(String name, org.jdom2.Namespace ns)StringgetChildTextNormalize(String name)StringgetChildTextNormalize(String name, org.jdom2.Namespace ns)StringgetChildTextTrim(String name)StringgetChildTextTrim(String name, org.jdom2.Namespace ns)ListgetContent()org.jdom2.ContentgetContent(int index)ListgetContent(org.jdom2.filter.Filter filter)intgetContentSize()protected MergeStrategygetDefaultMergeStrategy()Returns the defaultMergeStrategyinstance.IteratorgetDescendants()IteratorgetDescendants(org.jdom2.filter.Filter filter)org.jdom2.DocumentgetDocument()org.jdom2.ElementgetElement()Returns the wrapped up JDomElementinstance.protected ListgetElementNamesForConflictResolution(List defaultList)Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.StringgetName()org.jdom2.NamespacegetNamespace()org.jdom2.NamespacegetNamespace(String prefix)StringgetNamespacePrefix()StringgetNamespaceURI()org.jdom2.ParentgetParent()org.jdom2.ElementgetParentElement()StringgetQualifiedName()StringgetText()StringgetTextNormalize()StringgetTextTrim()StringgetValue()inthashCode()intindexOf(org.jdom2.Content child)booleanisAncestor(org.jdom2.Element element)protected abstract booleanisExpectedElementType(Mergeable me)Determines if the passed inMergeablewas of same type as this class.booleanisRootElement()abstract voidmerge(Mergeable me)Merges an element of same type.booleanremoveAttribute(String name)booleanremoveAttribute(String name, org.jdom2.Namespace ns)booleanremoveAttribute(org.jdom2.Attribute attribute)booleanremoveChild(String name)booleanremoveChild(String name, org.jdom2.Namespace ns)booleanremoveChildren(String name)booleanremoveChildren(String name, org.jdom2.Namespace ns)ListremoveContent()org.jdom2.ContentremoveContent(int index)booleanremoveContent(org.jdom2.Content child)ListremoveContent(org.jdom2.filter.Filter filter)voidremoveNamespaceDeclaration(org.jdom2.Namespace additionalNamespace)org.jdom2.ElementsetAttribute(String name, String value)org.jdom2.ElementsetAttribute(String name, String value, org.jdom2.Namespace ns)org.jdom2.ElementsetAttribute(org.jdom2.Attribute attribute)org.jdom2.ElementsetAttributes(List newAttributes)org.jdom2.ParentsetContent(int index, Collection collection)org.jdom2.ElementsetContent(int index, org.jdom2.Content child)org.jdom2.ElementsetContent(Collection newContent)org.jdom2.ElementsetContent(org.jdom2.Content child)org.jdom2.ElementsetName(String name)org.jdom2.ElementsetNamespace(org.jdom2.Namespace namespace)org.jdom2.ElementsetText(String text)StringtoString()Element.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
-
-
-
-
Method Detail
-
merge
public abstract void merge(Mergeable me) throws MergeException
Merges an element of same type.- Specified by:
mergein interfaceMergeable- 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 inMergeablewas of same type as this class.- Parameters:
me-Mergeableinstance to test.- Returns:
trueif the passed in Mergeable can be merged with the current Mergeable.
-
addContent
public org.jdom2.Element addContent(Collection collection)
- Parameters:
collection-Collection- Returns:
Element.
-
addContent
public org.jdom2.Element addContent(org.jdom2.Content child)
- Parameters:
child-Content- Returns:
Element.
-
addContent
public org.jdom2.Element addContent(int index, Collection c)- Parameters:
index- The index.c-Collection- Returns:
Element.
-
addContent
public org.jdom2.Element addContent(int index, org.jdom2.Content child)- Parameters:
index- The index.child-Content- Returns:
Element.
-
addContent
public org.jdom2.Element addContent(String str)
- Parameters:
str- The content to be added.- Returns:
Element.
-
addNamespaceDeclaration
public void addNamespaceDeclaration(org.jdom2.Namespace additional)
- Parameters:
additional-Namespace
-
cloneContent
public List cloneContent()
-
detach
public org.jdom2.Content detach()
-
getAdditionalNamespaces
public List getAdditionalNamespaces()
- Returns:
- list of Namespaces.
-
getAttribute
public org.jdom2.Attribute getAttribute(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name.ns-Namespace- Returns:
Attribute
-
getAttribute
public org.jdom2.Attribute getAttribute(String name)
- Parameters:
name- The name of the attribute.- Returns:
Attribute
-
getAttributes
public List getAttributes()
- Returns:
- list
Attribute
-
getAttributeValue
public String getAttributeValue(String name, org.jdom2.Namespace ns, String def)
- Parameters:
name- The name of the attribute.ns- TheNamespacedef- the default value.- Returns:
- The value of the attribute.
- See Also:
Element.getAttributeValue(java.lang.String,org.jdom2.Namespace,java.lang.String)
-
getAttributeValue
public String getAttributeValue(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the attribute.ns- TheNamespace- Returns:
- The value of the attribute.
- See Also:
Element.getAttributeValue(java.lang.String,org.jdom2.Namespace)
-
getAttributeValue
public String getAttributeValue(String name, String def)
- Parameters:
name- The name of the attribute.def- the default value.- Returns:
- The value of the attribute.
- See Also:
Element.getAttributeValue(java.lang.String,java.lang.String)
-
getAttributeValue
public String getAttributeValue(String name)
- Parameters:
name- The name of the attribute.- Returns:
- The value of the attribute.
- See Also:
Element.getAttributeValue(java.lang.String)
-
getChild
public org.jdom2.Element getChild(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
Element- See Also:
Element.getChild(java.lang.String,org.jdom2.Namespace)
-
getChild
public org.jdom2.Element getChild(String name)
- Parameters:
name- The name of the child.- Returns:
Element- See Also:
Element.getChild(java.lang.String)
-
getChildren
public List getChildren()
- Returns:
- list of
Element - See Also:
Element.getChildren()
-
getChildren
public List getChildren(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
- list
Element - See Also:
Element.getChildren(java.lang.String,org.jdom2.Namespace)
-
getChildren
public List getChildren(String name)
- Parameters:
name- The name.- Returns:
- list
Element - See Also:
Element.getChildren(java.lang.String)
-
getChildText
public String getChildText(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
- the child text.
- See Also:
Element.getChildText(java.lang.String,org.jdom2.Namespace)
-
getChildText
public String getChildText(String name)
- Parameters:
name- The name of the child.- Returns:
- the child text.
- See Also:
Element.getChildText(java.lang.String)
-
getChildTextNormalize
public String getChildTextNormalize(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
- the child text.
- See Also:
Element.getChildTextNormalize(java.lang.String,org.jdom2.Namespace)
-
getChildTextNormalize
public String getChildTextNormalize(String name)
- Parameters:
name- The name of the child.- Returns:
- the child text.
- See Also:
Element.getChildTextNormalize(java.lang.String)
-
getChildTextTrim
public String getChildTextTrim(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
- the child text.
- See Also:
Element.getChildTextTrim(java.lang.String,org.jdom2.Namespace)
-
getChildTextTrim
public String getChildTextTrim(String name)
- Parameters:
name- The name of the child.- Returns:
- the child text.
- See Also:
Element.getChildTextTrim(java.lang.String)
-
getContent
public List getContent()
- Returns:
- list of content.
- See Also:
Element.getContent()
-
getContent
public List getContent(org.jdom2.filter.Filter filter)
- Parameters:
filter-Filter- Returns:
- list of content.
- See Also:
Element.getContent(org.jdom2.filter.Filter)
-
getContent
public org.jdom2.Content getContent(int index)
- Parameters:
index- The index.- Returns:
- the content.
- See Also:
Element.getContent(int)
-
getContentSize
public int getContentSize()
- Returns:
- The content size.
- See Also:
Element.getContentSize()
-
getDescendants
public Iterator getDescendants()
- Returns:
Iteratorof descendants.- See Also:
Element.getDescendants()
-
getDescendants
public Iterator getDescendants(org.jdom2.filter.Filter filter)
- Parameters:
filter-Filter- Returns:
Iteratorof descendants.- See Also:
Element.getDescendants(org.jdom2.filter.Filter)
-
getDocument
public org.jdom2.Document getDocument()
- Returns:
- the document.
- See Also:
Content.getDocument()
-
getName
public String getName()
- Returns:
- The name of the element.
- See Also:
Element.getName()
-
getNamespace
public org.jdom2.Namespace getNamespace()
- Returns:
Namespace- See Also:
Element.getNamespace()
-
getNamespace
public org.jdom2.Namespace getNamespace(String prefix)
- Parameters:
prefix- The prefix.- Returns:
Namespace- See Also:
Element.getNamespace(java.lang.String)
-
getNamespacePrefix
public String getNamespacePrefix()
- Returns:
- the namespace prefix.
- See Also:
Element.getNamespacePrefix()
-
getNamespaceURI
public String getNamespaceURI()
- Returns:
- the namespace URI.
- See Also:
Element.getNamespaceURI()
-
getParent
public org.jdom2.Parent getParent()
- Returns:
- The parent.
- See Also:
Content.getParent()
-
getParentElement
public org.jdom2.Element getParentElement()
- Returns:
- the parent
Element - See Also:
Content.getParentElement()
-
getQualifiedName
public String getQualifiedName()
- Returns:
- The qualified name.
- See Also:
Element.getQualifiedName()
-
getText
public String getText()
- Returns:
- The text.
- See Also:
Element.getText()
-
getTextNormalize
public String getTextNormalize()
- Returns:
- the normalized text.
- See Also:
Element.getTextNormalize()
-
getTextTrim
public String getTextTrim()
- Returns:
- the trimmed text.
- See Also:
Element.getTextTrim()
-
getValue
public String getValue()
- Returns:
- the element value.
- See Also:
Element.getValue()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- See Also:
Object.hashCode()
-
indexOf
public int indexOf(org.jdom2.Content child)
- Parameters:
child- The child.- Returns:
- the index.
- See Also:
Element.indexOf(org.jdom2.Content)
-
isAncestor
public boolean isAncestor(org.jdom2.Element element)
- Parameters:
element-Element.- Returns:
- true/false.
- See Also:
Element.isAncestor(org.jdom2.Element)
-
isRootElement
public boolean isRootElement()
- Returns:
- true/false.
- See Also:
Element.isRootElement()
-
removeAttribute
public boolean removeAttribute(org.jdom2.Attribute attribute)
- Parameters:
attribute-Attribute- Returns:
- true/false.
- See Also:
Element.removeAttribute(org.jdom2.Attribute)
-
removeAttribute
public boolean removeAttribute(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the attribute.ns- TheNamespace- Returns:
- true/false.
- See Also:
Element.removeAttribute(java.lang.String,org.jdom2.Namespace)
-
removeAttribute
public boolean removeAttribute(String name)
- Parameters:
name- The mame of the attribute.- Returns:
- true/false.
- See Also:
Element.removeAttribute(java.lang.String)
-
removeChild
public boolean removeChild(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
- true/false.
- See Also:
Element.removeChild(java.lang.String,org.jdom2.Namespace)
-
removeChild
public boolean removeChild(String name)
- Parameters:
name- The name of the child.- Returns:
- true/false.
- See Also:
Element.removeChild(java.lang.String)
-
removeChildren
public boolean removeChildren(String name, org.jdom2.Namespace ns)
- Parameters:
name- The name of the child.ns-Namespace- Returns:
- true/false.
- See Also:
Element.removeChildren(java.lang.String,org.jdom2.Namespace)
-
removeChildren
public boolean removeChildren(String name)
- Parameters:
name- name of the child.- Returns:
- true/false.
- See Also:
Element.removeChildren(java.lang.String)
-
removeContent
public List removeContent()
- Returns:
- list of elements.
- See Also:
Element.removeContent()
-
removeContent
public boolean removeContent(org.jdom2.Content child)
- Parameters:
child-Content- Returns:
- true/false.
- See Also:
Element.removeContent(org.jdom2.Content)
-
removeContent
public List removeContent(org.jdom2.filter.Filter filter)
- Parameters:
filter-Filter.- Returns:
- list of elements.
- See Also:
Element.removeContent(org.jdom2.filter.Filter)
-
removeContent
public org.jdom2.Content removeContent(int index)
- Parameters:
index- The index.- Returns:
Content- See Also:
Element.removeContent(int)
-
removeNamespaceDeclaration
public void removeNamespaceDeclaration(org.jdom2.Namespace additionalNamespace)
- Parameters:
additionalNamespace-Namespace.- See Also:
Element.removeNamespaceDeclaration(org.jdom2.Namespace)
-
setAttribute
public org.jdom2.Element setAttribute(org.jdom2.Attribute attribute)
- Parameters:
attribute-Attribute- Returns:
Element.- See Also:
Element.setAttribute(org.jdom2.Attribute)
-
setAttribute
public org.jdom2.Element setAttribute(String name, String value, org.jdom2.Namespace ns)
- Parameters:
name- name of the attribute.value- The value of the attribute.ns-Namespace.- Returns:
Element- See Also:
Element.setAttribute(java.lang.String,java.lang.String,org.jdom2.Namespace)
-
setAttribute
public org.jdom2.Element setAttribute(String name, String value)
- Parameters:
name- name of the attribute.value- The value of the attribute.- Returns:
Element- See Also:
Element.setAttribute(java.lang.String,java.lang.String)
-
setAttributes
public org.jdom2.Element setAttributes(List newAttributes)
- Parameters:
newAttributes- list of new attributes.- Returns:
Element
-
setContent
public org.jdom2.Element setContent(Collection newContent)
- Parameters:
newContent-Collection- Returns:
Element- See Also:
Element.setContent(java.util.Collection)
-
setContent
public org.jdom2.Element setContent(org.jdom2.Content child)
- Parameters:
child-Content- Returns:
Element- See Also:
Element.setContent(org.jdom2.Content)
-
setContent
public org.jdom2.Parent setContent(int index, Collection collection)- Parameters:
index- The index.collection-Collection- Returns:
Parent- See Also:
Element.setContent(int,java.util.Collection)
-
setContent
public org.jdom2.Element setContent(int index, org.jdom2.Content child)- Parameters:
index- index.child-Content- Returns:
Element- See Also:
Element.setContent(int,org.jdom2.Content)
-
setName
public org.jdom2.Element setName(String name)
- Parameters:
name- The name of the element.- Returns:
Element- See Also:
Element.setName(java.lang.String)
-
setNamespace
public org.jdom2.Element setNamespace(org.jdom2.Namespace namespace)
- Parameters:
namespace-Namespace- Returns:
Element- See Also:
Element.setNamespace(org.jdom2.Namespace)
-
setText
public org.jdom2.Element setText(String text)
- Parameters:
text- The text to be set.- Returns:
Element- See Also:
Element.setText(java.lang.String)
-
getElement
public org.jdom2.Element getElement()
Returns the wrapped up JDomElementinstance. Returns the wrapped up JDomElementinstance that was used to create this Mergeable.- Specified by:
getElementin interfaceMergeable- Returns:
- the wrapped up JDom
Elementinstance.
-
getElementNamesForConflictResolution
protected List getElementNamesForConflictResolution(List defaultList)
Sub classes should override if they wish to provide a different combination of composite keys for determining conflicts.- Parameters:
defaultList- the default list.- Returns:
- the default list.
-
getDefaultMergeStrategy
protected MergeStrategy getDefaultMergeStrategy()
Returns the defaultMergeStrategyinstance.- Returns:
MergeStrategy
-
-