Class Xpp3Dom

  • All Implemented Interfaces:
    java.lang.Iterable<Xpp3Dom>

    public class Xpp3Dom
    extends java.lang.Object
    implements java.lang.Iterable<Xpp3Dom>
    A reimplementation of Plexus Xpp3Dom based on the public interface of Plexus Xpp3Dom.
    • Field Detail

      • name

        private java.lang.String name
      • value

        private java.lang.String value
      • attributes

        private java.util.Map<java.lang.String,​java.lang.String> attributes
      • childList

        final java.util.List<Xpp3Dom> childList
      • childMap

        final java.util.Map<java.lang.String,​Xpp3Dom> childMap
      • CHILDREN_COMBINATION_MODE_ATTRIBUTE

        public static final java.lang.String CHILDREN_COMBINATION_MODE_ATTRIBUTE
        The attribute which identifies merge/append.
        See Also:
        Constant Field Values
      • CHILDREN_COMBINATION_MERGE

        private static final java.lang.String CHILDREN_COMBINATION_MERGE
        See Also:
        Constant Field Values
      • CHILDREN_COMBINATION_APPEND

        public static final java.lang.String CHILDREN_COMBINATION_APPEND
        The attribute append.
        See Also:
        Constant Field Values
      • DEFAULT_CHILDREN_COMBINATION_MODE

        private static final java.lang.String DEFAULT_CHILDREN_COMBINATION_MODE
        See Also:
        Constant Field Values
      • SELF_COMBINATION_MODE_ATTRIBUTE

        public static final java.lang.String SELF_COMBINATION_MODE_ATTRIBUTE
        The name of the attribute.
        See Also:
        Constant Field Values
      • SELF_COMBINATION_OVERRIDE

        public static final java.lang.String SELF_COMBINATION_OVERRIDE
        The attributes which identifies override.
        See Also:
        Constant Field Values
      • SELF_COMBINATION_MERGE

        public static final java.lang.String SELF_COMBINATION_MERGE
        The attribute which identifies merge
        See Also:
        Constant Field Values
      • DEFAULT_SELF_COMBINATION_MODE

        private static final java.lang.String DEFAULT_SELF_COMBINATION_MODE
        See Also:
        Constant Field Values
      • EMPTY_STRING_ARRAY

        private static final java.lang.String[] EMPTY_STRING_ARRAY
      • EMPTY_DOM_ARRAY

        private static final Xpp3Dom[] EMPTY_DOM_ARRAY
    • Constructor Detail

      • Xpp3Dom

        public Xpp3Dom​(java.lang.String name)
        Parameters:
        name - The name of the instance.
      • Xpp3Dom

        public Xpp3Dom​(Xpp3Dom source)
        Create instance.
        Parameters:
        source - The source.
      • Xpp3Dom

        public Xpp3Dom​(@Nonnull
                       Xpp3Dom src,
                       java.lang.String name)
        Create instance.
        Parameters:
        src - The source Dom.
        name - The name of the Dom.
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns:
        The current name.
      • getValue

        @Nonnull
        public java.lang.String getValue()
        Returns:
        The current value.
      • setValue

        public void setValue​(@Nonnull
                             java.lang.String value)
        Parameters:
        value - The value to be set.
      • getAttributeNames

        public java.lang.String[] getAttributeNames()
        Returns:
        The array of attribute names.
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String nameParameter)
        Parameters:
        nameParameter - The name of the attribute.
        Returns:
        The attribute value.
      • setAttribute

        public void setAttribute​(@Nonnull
                                 java.lang.String nameParameter,
                                 @Nonnull
                                 java.lang.String valueParameter)
        Parameters:
        nameParameter - The name of the attribute.
        valueParameter - The value of the attribute.
      • getChild

        public Xpp3Dom getChild​(int i)
        Parameters:
        i - The index to be selected.
        Returns:
        The child selected by index.
      • getChild

        public Xpp3Dom getChild​(java.lang.String nameParameter)
        Parameters:
        nameParameter - The name of the child.
        Returns:
        The child selected by name.
      • addChild

        public void addChild​(Xpp3Dom child)
        Parameters:
        child - The child to be added.
      • getChildren

        public Xpp3Dom[] getChildren()
        Returns:
        The array of childs.
      • getChildrenList

        private java.util.List<Xpp3Dom> getChildrenList()
      • getChildren

        public Xpp3Dom[] getChildren​(java.lang.String nameParameter)
        Parameters:
        nameParameter - The name of the child.
        Returns:
        The array of the Dom.
      • getChildrenList

        java.util.List<Xpp3Dom> getChildrenList​(java.lang.String nameParameter)
      • getChildCount

        public int getChildCount()
        Returns:
        The number of childs.
      • removeChild

        public void removeChild​(int i)
        Parameters:
        i - The child to be removed.
      • getParent

        public Xpp3Dom getParent()
        Returns:
        The current parent.
      • setParent

        public void setParent​(Xpp3Dom parent)
        Parameters:
        parent - Set the parent.
      • mergeXpp3Dom

        public static Xpp3Dom mergeXpp3Dom​(Xpp3Dom dominant,
                                           Xpp3Dom recessive,
                                           java.lang.Boolean childMergeOverride)
        Parameters:
        dominant - The dominant part.
        recessive - The recessive part.
        childMergeOverride - true if child merge will take precedence false otherwise.
        Returns:
        The merged Xpp3Dom.
      • mergeXpp3Dom

        public static Xpp3Dom mergeXpp3Dom​(Xpp3Dom dominant,
                                           Xpp3Dom recessive)
        Parameters:
        dominant - The dominant part.
        recessive - The recessive part.
        Returns:
        The merged Xpp3Dom.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toUnescapedString

        public java.lang.String toUnescapedString()
        Returns:
        Unescaped string.
      • getPrettyPrintXMLWriter

        private PrettyPrintXMLWriter getPrettyPrintXMLWriter​(java.io.StringWriter writer)
      • isNotEmpty

        public static boolean isNotEmpty​(java.lang.String str)
        Parameters:
        str - The string to be checked.
        Returns:
        true if the string is not empty (length > 0) and not null.
      • isEmpty

        public static boolean isEmpty​(java.lang.String str)
        Parameters:
        str - The string to be checked.
        Returns:
        true if the string is empty or null.
      • iterator

        public java.util.Iterator<Xpp3Dom> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Xpp3Dom>