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
  • Field Details

    • element

      protected org.jdom2.Element element
      Wrapped JDOM element.
    • DEFAULT_MERGE_STRATEGY

      private static final MergeStrategy DEFAULT_MERGE_STRATEGY
      The default merging strategy used.
  • Constructor Details

    • AbstractMergeableSupport

      public AbstractMergeableSupport(org.jdom2.Element element)
      Parameters:
      element - Element
  • Method Details

    • merge

      public abstract void merge(Mergeable me) throws MergeException
      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.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
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • cloneContent

      public List cloneContent()
    • detach

      public org.jdom2.Content detach()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • 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 - The Namespace
      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 - The Namespace
      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 class Object
      See Also:
    • 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 - The Namespace
      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)
    • toString

      public String toString()
      Element.toString()
      Overrides:
      toString in class Object
    • getElement

      public org.jdom2.Element getElement()
      Returns the wrapped up JDom Element instance. Returns the wrapped up JDom Element instance that was used to create this Mergeable.
      Specified by:
      getElement in interface Mergeable
      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 default MergeStrategy instance.
      Returns:
      MergeStrategy