Class ResourceAddress

  • All Implemented Interfaces:
    Cloneable

    public class ResourceAddress
    extends ModelNode
    Represents a fully qualified DMR address ready to be put into a DMR operation. The address consists of 0-n segments with a name and a value for each segment.
    • Constructor Detail

      • ResourceAddress

        public ResourceAddress()
      • ResourceAddress

        public ResourceAddress​(ModelNode address)
    • Method Detail

      • root

        public static ResourceAddress root()
        Returns:
        the empty (root) address
      • from

        public static ResourceAddress from​(String address)
        Creates a new resource address from the specified string.
      • add

        public ResourceAddress add​(String propertyName,
                                   String propertyValue)
        Adds the specified segment to this address.
        Overrides:
        add in class ModelNode
        Parameters:
        propertyName - the property name
        propertyValue - the property value
        Returns:
        this address with the specified segment added
      • add

        public ResourceAddress add​(ResourceAddress address)
        Adds the specified address to this address.
        Parameters:
        address - The address to add.
        Returns:
        this address with the specified address added
      • firstValue

        public String firstValue()
        Returns:
        the value of the first segment or null if this address is empty.
      • lastName

        public String lastName()
        Returns:
        the name of the last segment or null if this address is empty.
      • lastValue

        public String lastValue()
        Returns:
        the value of the last segment or null if this address is empty.
      • getParent

        public ResourceAddress getParent()
        Returns:
        the parent address or the root address if this address has no parent.
      • size

        public int size()
        Returns:
        the number of segments.
      • isEmpty

        public boolean isEmpty()
        Returns:
        whether this address is empty.
      • startsWith

        public boolean startsWith​(ResourceAddress address)
        Checks if this resource address starts with the specified address.
        Parameters:
        address - The address to check as start
        Returns:
        true if this address starts with the passed one, false otherwise
      • replaceValue

        public ResourceAddress replaceValue​(String name,
                                            String newValue)
        Replaces the value in the specified segment
        Parameters:
        name - The name of the segment.
        newValue - The new value.
        Returns:
        this address containing the replaced value
      • toString

        public String toString()
        Description copied from class: ModelNode
        Get a human-readable string representation of this model node, formatted nicely (possibly on multiple lines).
        Overrides:
        toString in class ModelNode
        Returns:
        the address as string