Class NodeList

java.lang.Object
org.openhab.core.config.core.xml.util.NodeList
All Implemented Interfaces:
NodeName

@NonNullByDefault public class NodeList extends Object implements NodeName
The NodeList class contains the node name and its according list of values for an XML tag.

This class can be used for an intermediate conversion result of a list of values for an XML tag. The conversion can be done by using the according NodeListConverter.

Hint: This class is immutable.

Author:
Michael Grammling - Initial contribution
  • Constructor Details

    • NodeList

      public NodeList(String nodeName, Map<String,String> attributes, List<@NonNull ?> list) throws IllegalArgumentException
      Creates a new instance of this class with the specified parameters.
      Parameters:
      nodeName - the name of the node this object belongs to (must not be empty)
      attributes - all attributes of the node this object belongs to (could be empty)
      list - the list of the node this object belongs to (could be empty)
      Throws:
      IllegalArgumentException - if the name of the node is empty
  • Method Details

    • getNodeName

      public String getNodeName()
      Description copied from interface: NodeName
      Returns the name of the node this object belongs to.
      Specified by:
      getNodeName in interface NodeName
      Returns:
      the name of the node this object belongs to (not empty)
    • getAttributes

      public Map<String,String> getAttributes()
      Returns the attributes of the node as key-value map
      Returns:
      the attributes of the node as key-value map (could be null or empty).
    • getList

      public List<@NonNull ?> getList()
      Returns the list of values of the node
      Returns:
      the list of values of the node (could be null or empty).
    • getAttributes

      public List<String> getAttributes(String nodeName, String attributeName) throws com.thoughtworks.xstream.converters.ConversionException
      Throws:
      com.thoughtworks.xstream.converters.ConversionException
      See Also:
    • getAttributes

      public List<String> getAttributes(String nodeName, String attributeName, @Nullable String formattedText) throws com.thoughtworks.xstream.converters.ConversionException
      Returns the attributes of the specified XML node and attribute name for the whole list.

      This list MUST ONLY contain NodeAttributes.

      Parameters:
      nodeName - the node name to be considered (must neither be null, nor empty)
      attributeName - the attribute name to be considered (must neither be null, nor empty)
      formattedText - the format for the output text using the placeholder format of the Java String (could be null or empty)
      Returns:
      the attributes of the specified XML node and attribute name for the whole list (could be null or empty)
      Throws:
      com.thoughtworks.xstream.converters.ConversionException - if the attribute could not be found in the specified node
    • toString

      public String toString()
      Overrides:
      toString in class Object