- 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.praxislive.core.Value
Value.Type<T extends Value>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcomponentID()Equivalent to componentID(depth() - 1).StringcomponentID(int depth)Get ID at given depth in address.intdepth()Number of ID parts to this addressbooleanequals(Object obj)Values must override the default equals method.static Optional<ComponentAddress>from(Value arg)inthashCode()Values must override the default hashcode method.static ArgumentInfoinfo()static booleanisValidID(String id)static ComponentAddressof(String address)Create an address from the supplied Stringstatic ComponentAddressof(ComponentAddress address, String path)Create a ComponentAddress by adding the supplied path to the end of the supplied ComponentAddress.ComponentAddressparent()static ComponentAddressparse(String addressString)Create an address from the supplied StringStringrootID()Equivalent to componentID(0).StringtoString()Values must override the default method to return a string representation that is immutable.-
Methods inherited from class org.praxislive.core.Value
equivalent, isEmpty, type
-
-
-
-
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()
-
toString
public String toString()
Description copied from class:ValueValues must override the default method to return a string representation that is immutable.
-
hashCode
public int hashCode()
Description copied from class:ValueValues must override the default hashcode method.
-
equals
public boolean equals(Object obj)
Description copied from class:ValueValues must override the default equals method. This method should only returntrueif 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 thatthis.equals(that) == this.toString().equals(that.toString())
-
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()
-
-