Class ComponentAddress


  • public final class ComponentAddress
    extends Value
    Address of a Component. A component is a slash separated path of IDs, starting with the ID of the Root that the Component is in, eg. /rootID/parentID/componentID. ComponentAddresses are always absolute.
    • Method Detail

      • depth

        public int depth()
        Number of ID parts to this address
        Returns:
        int Depth (always >=1)
      • componentID

        public String componentID​(int depth)
        Get ID at given depth in address.
        Parameters:
        depth -
        Returns:
        String ID
      • componentID

        public String componentID()
        Equivalent to componentID(depth() - 1).
        Returns:
        String
      • rootID

        public String rootID()
        Equivalent to componentID(0).
        Returns:
        String
      • parent

        public ComponentAddress parent()
        The parent address. Returns null if this is a root address (depth == 1).
        Returns:
        parent address, or null if root address.
      • resolve

        public ComponentAddress resolve​(String path)
        Resolve the provided path or child ID against this address. The path should be relative and not start with a slash.
        Parameters:
        path - relative address to resolve
        Returns:
        resolved address
      • port

        public PortAddress port​(String id)
        Get a PortAddress for a port on this component.
        Parameters:
        id - port id
        Returns:
        port address
      • toString

        public String toString()
        Description copied from class: Value
        Values must override the default method to return a string representation that is immutable.
        Specified by:
        toString in class Value
        Returns:
        String representation
      • hashCode

        public int hashCode()
        Description copied from class: Value
        Values must override the default hashcode method.
        Specified by:
        hashCode in class Value
        Returns:
        int hashcode
      • equals

        public boolean equals​(Object obj)
        Description copied from class: Value
        Values must override the default equals method. This method should only return true if the supplied Object is of the same type as the implementing Value. Values of an unknown type should be coerced before calling this method. This method does not have to guarantee that this.equals(that) == this.toString().equals(that.toString())
        Specified by:
        equals in class Value
        Returns:
        boolean
      • isValidID

        public static boolean isValidID​(String id)
        Parameters:
        id -
        Returns: