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