Class AbstractMergeableSupport
java.lang.Object
org.codehaus.plexus.metadata.merge.support.AbstractMergeableSupport
- All Implemented Interfaces:
Mergeable
- Direct Known Subclasses:
AbstractMergeableElement
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MergeStrategy
The default merging strategy used.protected org.jdom2.Element
Wrapped JDOM element. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.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) clone()
org.jdom2.Content
detach()
boolean
org.jdom2.Attribute
getAttribute
(String name) org.jdom2.Attribute
getAttribute
(String name, org.jdom2.Namespace ns) getAttributeValue
(String name) getAttributeValue
(String name, String def) getAttributeValue
(String name, org.jdom2.Namespace ns) getAttributeValue
(String name, org.jdom2.Namespace ns, String def) org.jdom2.Element
org.jdom2.Element
getChildren
(String name) getChildren
(String name, org.jdom2.Namespace ns) getChildText
(String name) getChildText
(String name, org.jdom2.Namespace ns) getChildTextNormalize
(String name) getChildTextNormalize
(String name, org.jdom2.Namespace ns) getChildTextTrim
(String name) getChildTextTrim
(String name, org.jdom2.Namespace ns) org.jdom2.Content
getContent
(int index) getContent
(org.jdom2.filter.Filter filter) int
protected MergeStrategy
Returns the defaultMergeStrategy
instance.getDescendants
(org.jdom2.filter.Filter filter) org.jdom2.Document
org.jdom2.Element
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.getName()
org.jdom2.Namespace
org.jdom2.Namespace
getNamespace
(String prefix) org.jdom2.Parent
org.jdom2.Element
getText()
getValue()
int
hashCode()
int
indexOf
(org.jdom2.Content child) boolean
isAncestor
(org.jdom2.Element element) protected abstract boolean
Determines if the passed inMergeable
was of same type as this class.boolean
abstract void
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) org.jdom2.Content
removeContent
(int index) boolean
removeContent
(org.jdom2.Content child) 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
org.jdom2.Element
setNamespace
(org.jdom2.Namespace namespace) org.jdom2.Element
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
-
Field Details
-
element
protected org.jdom2.Element elementWrapped JDOM element. -
DEFAULT_MERGE_STRATEGY
The default merging strategy used.
-
-
Constructor Details
-
AbstractMergeableSupport
public AbstractMergeableSupport(org.jdom2.Element element) - Parameters:
element
-Element
-
-
Method Details
-
merge
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
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
- Parameters:
collection
-Collection
- Returns:
Element
.
-
addContent
public org.jdom2.Element addContent(org.jdom2.Content child) - Parameters:
child
-Content
- Returns:
Element
.
-
addContent
- 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
- Parameters:
str
- The content to be added.- Returns:
Element
.
-
addNamespaceDeclaration
public void addNamespaceDeclaration(org.jdom2.Namespace additional) - Parameters:
additional
-Namespace
-
clone
-
cloneContent
-
detach
public org.jdom2.Content detach() -
equals
-
getAdditionalNamespaces
- Returns:
- list of Namespaces.
-
getAttribute
- Parameters:
name
- The name.ns
-Namespace
- Returns:
Attribute
-
getAttribute
- Parameters:
name
- The name of the attribute.- Returns:
Attribute
-
getAttributes
- Returns:
- list
Attribute
-
getAttributeValue
- 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
- 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
- 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
- Parameters:
name
- The name of the attribute.- Returns:
- The value of the attribute.
- See Also:
-
Element.getAttributeValue(java.lang.String)
-
getChild
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
Element
- See Also:
-
Element.getChild(java.lang.String,org.jdom2.Namespace)
-
getChild
- Parameters:
name
- The name of the child.- Returns:
Element
- See Also:
-
Element.getChild(java.lang.String)
-
getChildren
- Returns:
- list of
Element
- See Also:
-
Element.getChildren()
-
getChildren
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
- list
Element
- See Also:
-
Element.getChildren(java.lang.String,org.jdom2.Namespace)
-
getChildren
- Parameters:
name
- The name.- Returns:
- list
Element
- See Also:
-
Element.getChildren(java.lang.String)
-
getChildText
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
- the child text.
- See Also:
-
Element.getChildText(java.lang.String,org.jdom2.Namespace)
-
getChildText
- Parameters:
name
- The name of the child.- Returns:
- the child text.
- See Also:
-
Element.getChildText(java.lang.String)
-
getChildTextNormalize
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
- the child text.
- See Also:
-
Element.getChildTextNormalize(java.lang.String,org.jdom2.Namespace)
-
getChildTextNormalize
- Parameters:
name
- The name of the child.- Returns:
- the child text.
- See Also:
-
Element.getChildTextNormalize(java.lang.String)
-
getChildTextTrim
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
- the child text.
- See Also:
-
Element.getChildTextTrim(java.lang.String,org.jdom2.Namespace)
-
getChildTextTrim
- Parameters:
name
- The name of the child.- Returns:
- the child text.
- See Also:
-
Element.getChildTextTrim(java.lang.String)
-
getContent
- Returns:
- list of content.
- See Also:
-
Element.getContent()
-
getContent
- 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
- Returns:
Iterator
of descendants.- See Also:
-
Element.getDescendants()
-
getDescendants
- 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
- Returns:
- The name of the element.
- See Also:
-
Element.getName()
-
getNamespace
public org.jdom2.Namespace getNamespace()- Returns:
Namespace
- See Also:
-
Element.getNamespace()
-
getNamespace
- Parameters:
prefix
- The prefix.- Returns:
Namespace
- See Also:
-
Element.getNamespace(java.lang.String)
-
getNamespacePrefix
- Returns:
- the namespace prefix.
- See Also:
-
Element.getNamespacePrefix()
-
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
- Returns:
- The qualified name.
- See Also:
-
Element.getQualifiedName()
-
getText
- Returns:
- The text.
- See Also:
-
Element.getText()
-
getTextNormalize
- Returns:
- the normalized text.
- See Also:
-
Element.getTextNormalize()
-
getTextTrim
- Returns:
- the trimmed text.
- See Also:
-
Element.getTextTrim()
-
getValue
- Returns:
- the element value.
- See Also:
-
Element.getValue()
-
hashCode
public int 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
- Parameters:
name
- The name of the attribute.ns
- TheNamespace
- Returns:
- true/false.
- See Also:
-
Element.removeAttribute(java.lang.String,org.jdom2.Namespace)
-
removeAttribute
- Parameters:
name
- The mame of the attribute.- Returns:
- true/false.
- See Also:
-
Element.removeAttribute(java.lang.String)
-
removeChild
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
- true/false.
- See Also:
-
Element.removeChild(java.lang.String,org.jdom2.Namespace)
-
removeChild
- Parameters:
name
- The name of the child.- Returns:
- true/false.
- See Also:
-
Element.removeChild(java.lang.String)
-
removeChildren
- Parameters:
name
- The name of the child.ns
-Namespace
- Returns:
- true/false.
- See Also:
-
Element.removeChildren(java.lang.String,org.jdom2.Namespace)
-
removeChildren
- Parameters:
name
- name of the child.- Returns:
- true/false.
- See Also:
-
Element.removeChildren(java.lang.String)
-
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
- 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
- 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
- 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
- Parameters:
newAttributes
- list of new attributes.- Returns:
Element
-
setContent
- 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
- 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
- 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
- Parameters:
text
- The text to be set.- Returns:
Element
- See Also:
-
Element.setText(java.lang.String)
-
toString
Element.toString()
-
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
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
Returns the defaultMergeStrategy
instance.- Returns:
MergeStrategy
-