Class ComponentAddress

java.lang.Object
org.praxislive.core.Value
org.praxislive.core.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.
  • Field Details

  • Method Details

    • 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
    • control

      public ControlAddress control(String id)
      Get a ControlAddress for a control on this component.
      Parameters:
      id - control id
      Returns:
      control 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
      Parameters:
      obj -
      Returns:
      boolean
    • parse

      public static ComponentAddress parse(String addressString) throws ValueFormatException
      Create an address from the supplied String
      Parameters:
      addressString -
      Returns:
      ComponentAddress
      Throws:
      ValueFormatException
    • of

      public static ComponentAddress of(String address)
      Create an address from the supplied String
      Parameters:
      address -
      Returns:
      ComponentAddress
      Throws:
      IllegalArgumentException - on invalid string
    • of

      public static ComponentAddress of(ComponentAddress address, String path)
      Create a ComponentAddress by adding the supplied path to the end of the supplied ComponentAddress.
      Parameters:
      address -
      path -
      Returns:
      ComponentAddress
      Throws:
      IllegalArgumentException
    • from

      public static Optional<ComponentAddress> from(Value arg)
    • isValidID

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

      public static ArgumentInfo info()