Class PathAddress

java.lang.Object
org.wildfly.galleon.plugin.doc.generator.PathAddress
All Implemented Interfaces:
Iterable<PathElement>

public class PathAddress extends Object implements Iterable<PathElement>
A path address for an operation.
Author:
Brian Stansberry, David M. Lloyd
  • Field Details

    • EMPTY_ADDRESS

      public static final PathAddress EMPTY_ADDRESS
      An empty address.
  • Method Details

    • pathAddress

      public static PathAddress pathAddress(org.jboss.dmr.ModelNode node)
      Creates a PathAddress from the given ModelNode address. The given node is expected to be an address node.
      Parameters:
      node - the node (cannot be null)
      Returns:
      the update identifier
    • pathAddress

      public static PathAddress pathAddress(List<PathElement> elements)
    • pathAddress

      public static PathAddress pathAddress(PathElement... elements)
    • pathAddress

      public static PathAddress pathAddress(String key, String value)
    • pathAddress

      public static PathAddress pathAddress(PathAddress parent, PathElement... elements)
    • getElement

      public PathElement getElement(int index)
      Gets the element at the given index.
      Parameters:
      index - the index
      Returns:
      the element
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
    • getLastElement

      public PathElement getLastElement()
      Gets the last element in the address.
      Returns:
      the element, or null if size() is zero.
    • subAddress

      public PathAddress subAddress(int start)
      Get a portion of this address using segments starting at start (inclusive).
      Parameters:
      start - the start index
      Returns:
      the partial address
    • subAddress

      public PathAddress subAddress(int start, int end)
      Get a portion of this address using segments between start (inclusive) and end (exclusive).
      Parameters:
      start - the start index
      end - the end index
      Returns:
      the partial address
    • append

      public PathAddress append(List<PathElement> additionalElements)
      Create a new path address by appending more elements to the end of this address.
      Parameters:
      additionalElements - the elements to append
      Returns:
      the new path address
    • append

      public PathAddress append(PathElement... additionalElements)
      Create a new path address by appending more elements to the end of this address.
      Parameters:
      additionalElements - the elements to append
      Returns:
      the new path address
    • append

      public PathAddress append(PathAddress address)
      Create a new path address by appending more elements to the end of this address.
      Parameters:
      address - the address to append
      Returns:
      the new path address
    • append

      public PathAddress append(String key, String value)
    • append

      public PathAddress append(String key)
    • remove

      public org.jboss.dmr.ModelNode remove(org.jboss.dmr.ModelNode model) throws NoSuchElementException
      Navigate to, and remove, this address in the given model node.
      Parameters:
      model - the model node
      Returns:
      the submodel
      Throws:
      NoSuchElementException - if the model contains no such element
    • toModelNode

      public org.jboss.dmr.ModelNode toModelNode()
      Convert this path address to its model node representation.
      Returns:
      the model node list of properties
    • isMultiTarget

      public boolean isMultiTarget()
      Check whether this address applies to multiple targets.
      Returns:
      true if the address can apply to multiple targets, false otherwise
    • size

      public int size()
      Get the size of this path, in elements.
      Returns:
      the size
    • iterator

      public ListIterator<PathElement> iterator()
      Iterate over the elements of this path address.
      Specified by:
      iterator in interface Iterable<PathElement>
      Returns:
      the iterator
    • getParent

      public PathAddress getParent()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Determine whether this object is equal to another.
      Overrides:
      equals in class Object
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • equals

      public boolean equals(PathAddress other)
      Determine whether this object is equal to another.
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toCLIStyleString

      public String toCLIStyleString()
    • toHttpStyleString

      public String toHttpStyleString()
    • toPathStyleString

      public String toPathStyleString()
    • parseCLIStyleAddress

      public static PathAddress parseCLIStyleAddress(String address) throws IllegalArgumentException
      Throws:
      IllegalArgumentException