Class AttributeContainer

    • Constructor Summary

      Constructors 
      Constructor Description
      AttributeContainer()
      Constructs an AttributeContainer object.
      AttributeContainer​(Attribute[] attributes)
      Constructs an AttributeContainer using an array of Attribute objects.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Attribute[] attributesFromXml​(org.w3c.dom.Element element)
      Adds the Attributes from the Element to this AttributeContainer.
      void clear()
      Clears this AttributeContainer.
      Attribute getAttributeByName​(java.lang.String attributeName)
      Returns an Attribute from this AttributeContainer based on the AttributeName string provided.
      Attribute getAttributeByNameAndType​(java.lang.String name, java.lang.String type)
      Returns an Attribute from this AttributeContainer based on the name string and type string provided.
      java.util.Iterator getAttributeIterator()
      Returns an Iterator over the values in this Attribute container.
      Attribute[] getAttributes()
      Returns an Attribute array containing this AttributeContainers Attribute objects.
      Attribute[] getAttributesByType​(java.lang.String attributeType)
      Returns an array of attributes from this AttributeContainer based on the specified attribute type
      java.lang.String getAttributeValueByName​(java.lang.String attributeName)
      Return the first attribute value as a String based on the attribute name String provided.
      java.lang.String getAttributeValueByNameAndType​(java.lang.String attributeName, java.lang.String attributeType)
      Return the first attribute value as a String based on the attribute name and type provided.
      java.lang.String[] getAttributeValuesByName​(java.lang.String attributeName)
      Returns a String array of attribute values based on the attribute name String provided.
      java.lang.String[] getAttributeValuesByNameAndType​(java.lang.String name, java.lang.String type)
      Returns Attribute values as a String array from this AttributeContainer based on the name string and type string provided.
      int getNumberOfAttributes()
      Returns the number of Attributes in this AttributeContainer.
      boolean removeAttribute​(Attribute attr)
      Removes an Attribute from this AttributeContainer based on the Attribute provided (Matches on the name and type).
      java.lang.String[] removeAttributeByNameAndType​(java.lang.String name, java.lang.String type)
      Removes an Attribute from this AttributeContainer based on the name string and type string provided.
      int removeAttributes​(java.lang.String name, java.lang.String type)
      Return attributes that match name and type.
      Attribute setAttribute​(Attribute attr)
      Sets an attribute in this AttributeContainer based on the Attribute provided.
      java.lang.String[] setAttribute​(java.lang.String name, java.lang.String type, java.lang.String[] values)
      Sets an Attribute in this AttributeContainer based on the name, type and String array of values provided.
      java.lang.String[] setAttribute​(java.lang.String name, java.lang.String type, java.lang.String nickname, java.lang.String[] values)
      Sets an Attribute in this AttributeContainer based on the name, type and String array of values provided.
      void setAttribute​(java.lang.String name, java.lang.String type, java.lang.String nickname, java.lang.String[] values, org.w3c.dom.Node[] nodes)
      Set attributes in this AttributeContainer based on the name, type and Node array values provided.
      org.w3c.dom.Node[] setAttribute​(java.lang.String name, java.lang.String type, java.lang.String nickname, org.w3c.dom.Node[] values)
      Set attributes in this AttributeContainer based on the name, type, nickname and Node array values provided.
      org.w3c.dom.Node[] setAttribute​(java.lang.String name, java.lang.String type, org.w3c.dom.Node[] values)
      Set attributes in this AttributeContainer based on the name, type and Node array values provided.
      void setAttributes​(Attribute[] attributes)
      Sets the attributes in this AttributeContainer using the supplied Attribute array.
      org.w3c.dom.Element toXml​(org.w3c.dom.Document owner)
      Converts this AttributeContainer to XML in the form of an org.w3c.dom.Element object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • AttributeContainer_java_sourceCodeID

        public static final java.lang.String AttributeContainer_java_sourceCodeID
        See Also:
        Constant Field Values
      • AttributeContainer_java_copyright

        public static final java.lang.String AttributeContainer_java_copyright
    • Constructor Detail

      • AttributeContainer

        public AttributeContainer()
        Constructs an AttributeContainer object.
      • AttributeContainer

        public AttributeContainer​(Attribute[] attributes)
        Constructs an AttributeContainer using an array of Attribute objects.
        Parameters:
        attributes - an array of Attribute objects
    • Method Detail

      • getAttributes

        public Attribute[] getAttributes()
        Returns an Attribute array containing this AttributeContainers Attribute objects.
        Returns:
        an Attribute array containing this AttributeContainers Attribute objects.
      • setAttributes

        public final void setAttributes​(Attribute[] attributes)
        Sets the attributes in this AttributeContainer using the supplied Attribute array.
        Parameters:
        attributes - an Attribute[] of Attributes to be added to this AttributeContainer.
      • getAttributeValueByName

        public java.lang.String getAttributeValueByName​(java.lang.String attributeName)
        Return the first attribute value as a String based on the attribute name String provided.
        Parameters:
        attributeName - the name of an attribute
        Returns:
        the first attribute value, as a String, of the attribute name provided. Returns null if the attribute name is not present in this AttributeContainer.
      • getAttributeValueByNameAndType

        public java.lang.String getAttributeValueByNameAndType​(java.lang.String attributeName,
                                                               java.lang.String attributeType)
        Return the first attribute value as a String based on the attribute name and type provided.
        Parameters:
        attributeName - the name of an attribute
        attributeType - the type of the attribute
        Returns:
        the first attribute value, as a String, of the attribute name provided. Returns null if the attribute name is not present in this AttributeContainer.
      • getAttributeValuesByName

        public java.lang.String[] getAttributeValuesByName​(java.lang.String attributeName)
        Returns a String array of attribute values based on the attribute name String provided.
        Parameters:
        attributeName - the name of an attribute
        Returns:
        a String array of attribute values based on the attribute name String provided. Returns null if the attribute name is not present in this AttributeContainer.
      • getAttributeByName

        public Attribute getAttributeByName​(java.lang.String attributeName)
        Returns an Attribute from this AttributeContainer based on the AttributeName string provided.
        Parameters:
        attributeName - the name of an attribute
        Returns:
        the Attribute from this AttributeContainer based on the attribute name String provided. Returns null if the attribute name is not present in this AttributeContainer.
      • getAttributesByType

        public Attribute[] getAttributesByType​(java.lang.String attributeType)
        Returns an array of attributes from this AttributeContainer based on the specified attribute type
        Parameters:
        attributeType - the type of the attribute(s) to be returned
        Returns:
        An array of attributes from this AttributeContainer based on the specified attribute type. provided. Returns null if no matching attributes present in this AttributeContainer.
      • getAttributeByNameAndType

        public Attribute getAttributeByNameAndType​(java.lang.String name,
                                                   java.lang.String type)
        Returns an Attribute from this AttributeContainer based on the name string and type string provided.
        Parameters:
        name - the name of an Attribute
        type - the type of Attribute
        Returns:
        the Attribute from this AttributeContainer based on the attribute name string and type string provided. Returns null if the attribute name and type is not present in this AttributeContainer.
      • getAttributeValuesByNameAndType

        public java.lang.String[] getAttributeValuesByNameAndType​(java.lang.String name,
                                                                  java.lang.String type)
        Returns Attribute values as a String array from this AttributeContainer based on the name string and type string provided.
        Parameters:
        name - the name of an Attribute
        type - the type of Attribute
        Returns:
        the attribute values as a String array from this AttributeContainer based on the attribute name string and type string provided. Returns null if the attribute name and type is not present in this AttributeContainer.
      • removeAttributeByNameAndType

        public java.lang.String[] removeAttributeByNameAndType​(java.lang.String name,
                                                               java.lang.String type)
        Removes an Attribute from this AttributeContainer based on the name string and type string provided. Returns the Attribute values as a String array the Attribute was found in this AttributeContainer.
        Parameters:
        name - the name of an Attribute
        type - the type of Attribute
        Returns:
        the attribute values as a String array from this AttributeContainer based on the attribute name string and type string provided. Returns null if the attribute name and type is not present in this AttributeContainer.
      • removeAttribute

        public boolean removeAttribute​(Attribute attr)
        Removes an Attribute from this AttributeContainer based on the Attribute provided (Matches on the name and type). Returns true if the attribute was found and removed, otherwise returns false.
        Parameters:
        attr - the Attribute to remove from this AttributeContainer.
        Returns:
        true if the attribute was found and removed, otherwise returns false.
      • setAttribute

        public java.lang.String[] setAttribute​(java.lang.String name,
                                               java.lang.String type,
                                               java.lang.String[] values)
        Sets an Attribute in this AttributeContainer based on the name, type and String array of values provided.
        Parameters:
        name - the name of the attribute
        type - the Attribute type
        values - a String array of attribute values
        Returns:
        the values as a String array of the Attribute
      • setAttribute

        public java.lang.String[] setAttribute​(java.lang.String name,
                                               java.lang.String type,
                                               java.lang.String nickname,
                                               java.lang.String[] values)
        Sets an Attribute in this AttributeContainer based on the name, type and String array of values provided.
        Parameters:
        name - the name of the Attribute to be added to this AttributeContainer
        type - the Attribute type
        nickname - the nickname of the Attribute to be added to this AttributeContainer
        values - a String array of attribute values
        Returns:
        the values as a String array of the Attribute added to or modified in this AttributeContainer.
      • setAttribute

        public org.w3c.dom.Node[] setAttribute​(java.lang.String name,
                                               java.lang.String type,
                                               org.w3c.dom.Node[] values)
        Set attributes in this AttributeContainer based on the name, type and Node array values provided.
        Parameters:
        name - the Attribute name
        type - the type of Attribute
        values - the values of the Attribute to be added to this AttributeContainer as an array of Nodes.
        Returns:
        a Node array of the values of the Attribute added to this AttributeContainer.
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.String type,
                                 java.lang.String nickname,
                                 java.lang.String[] values,
                                 org.w3c.dom.Node[] nodes)
        Set attributes in this AttributeContainer based on the name, type and Node array values provided.
        Parameters:
        name - the Attribute name to be set in the AttributeContainer
        type - the type of Attribute to be set in the AttributeContainer
        nickname - the nickname of the Attribute to be set in the AttributeContainer
        values - the values of the Attribute to be added to this AttributeContainer as an array of Strings.
        nodes - the values of the Attribute to be added to this AttributeContainer as an array of Nodes.
      • setAttribute

        public org.w3c.dom.Node[] setAttribute​(java.lang.String name,
                                               java.lang.String type,
                                               java.lang.String nickname,
                                               org.w3c.dom.Node[] values)
        Set attributes in this AttributeContainer based on the name, type, nickname and Node array values provided.
        Parameters:
        name - the Attribute name
        type - the type of Attribute
        nickname - the nickname of the Attribute
        values - the values of the Attribute to be added to this AttributeContainer as an array of Nodes.
        Returns:
        a Node array of the values of the Attribute added to this AttributeContainer.
      • setAttribute

        public Attribute setAttribute​(Attribute attr)
        Sets an attribute in this AttributeContainer based on the Attribute provided.
        Parameters:
        attr - the Attribute to set in this AttributeContainer.
        Returns:
        the Attribute set in this AttributeContainer.
      • getAttributeIterator

        public java.util.Iterator getAttributeIterator()
        Returns an Iterator over the values in this Attribute container.
        Returns:
        an Iterator over the values in this Attribute container.
      • getNumberOfAttributes

        public int getNumberOfAttributes()
        Returns the number of Attributes in this AttributeContainer.
        Returns:
        the number of Attributes in this AttributeContainer.
      • clear

        public void clear()
        Clears this AttributeContainer.
      • removeAttributes

        public int removeAttributes​(java.lang.String name,
                                    java.lang.String type)
        Return attributes that match name and type. If either input is null, it'll match any value. Effectively name = null && type = null is clear()
        Parameters:
        name - The name to match or null to match all
        type - The type to match or null to match all
        Returns:
        The number of attributes removed.
      • attributesFromXml

        public static Attribute[] attributesFromXml​(org.w3c.dom.Element element)
        Adds the Attributes from the Element to this AttributeContainer.
        Parameters:
        element - the element which contains attributes to add to this AttributeContainer.
        Returns:
        an array of Attributes added to this AttributeContainer or null if element is null.
      • toXml

        public org.w3c.dom.Element toXml​(org.w3c.dom.Document owner)
        Converts this AttributeContainer to XML in the form of an org.w3c.dom.Element object.
        Parameters:
        owner - owner XML Document
        Returns:
        the XML in the form of an org.w3c.dom.Element object.