Class NodeAttributes
java.lang.Object
org.openhab.core.config.core.xml.util.NodeAttributes
- All Implemented Interfaces:
NodeName
The
NodeAttributes
class contains all attributes for an XML tag.
This class DOES NOT support XML tags with attributes AND values, it only supports attributes.
This class can be used for an intermediate conversion result of attributes for an XML tag. The conversion can be done
by using the according NodeAttributesConverter
.
Hint: This class is immutable.
- Author:
- Michael Grammling - Initial contribution
-
Constructor Summary
ConstructorDescriptionNodeAttributes
(String nodeName, @Nullable Map<String, String> attributes) Creates a new instance of this class with the specified parameters. -
Method Summary
Modifier and TypeMethodDescription@Nullable String
getAttribute
(String name) Returns the value of the specified attribute.Returns the map of all attributes of a node by key-value pairs.Returns the name of the node this object belongs to.toString()
-
Constructor Details
-
NodeAttributes
public NodeAttributes(String nodeName, @Nullable Map<String, String> attributes) throws IllegalArgumentExceptionCreates a new instance of this class with the specified parameters.- Parameters:
nodeName
- the name of the node this object belongs to (must neither be null, nor empty)attributes
- the map of all attributes of the node this object belongs to by key-value pairs (could be null or empty)- Throws:
IllegalArgumentException
- if the name of the node is empty
-
-
Method Details
-
getNodeName
Description copied from interface:NodeName
Returns the name of the node this object belongs to.- Specified by:
getNodeName
in interfaceNodeName
- Returns:
- the name of the node this object belongs to (not empty)
-
getAttribute
Returns the value of the specified attribute.- Parameters:
name
- the name of the attribute whose value should be returned (could be null or empty)- Returns:
- the value of the specified attribute (could be empty)
-
getAttributes
Returns the map of all attributes of a node by key-value pairs.- Returns:
- the map of all attributes of a node
-
toString
-