Class NodeList
java.lang.Object
org.openhab.core.config.core.xml.util.NodeList
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the attributes of the node as key-value mapgetAttributes(String nodeName, String attributeName) getAttributes(String nodeName, String attributeName, @Nullable String formattedText) Returns the attributes of the specified XML node and attribute name for the whole list.List<@NonNull ?> getList()Returns the list of values of the nodeReturns the name of the node this object belongs to.toString()
-
Constructor Details
-
NodeList
public NodeList(String nodeName, Map<String, String> attributes, List<@NonNull ?> list) throws IllegalArgumentExceptionCreates 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
Description copied from interface:NodeNameReturns the name of the node this object belongs to.- Specified by:
getNodeNamein interfaceNodeName- Returns:
- the name of the node this object belongs to (not empty)
-
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
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
-