Package com.relaypro.sdk
Class RelayUri
- java.lang.Object
-
- com.relaypro.sdk.RelayUri
-
public class RelayUri extends java.lang.Object
Utilities for working with URIs (aka URNs) for Relay devices, groups, and interactions.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEVICE
static java.lang.String
DEVICE_PATTERN
static java.lang.String
GROUP
static java.lang.String
ID
static java.lang.String
INTERACTION
static java.lang.String
INTERACTION_URI_ID
static java.lang.String
INTERACTION_URI_NAME
static java.lang.String
NAME
static java.lang.String
ROOT
static java.lang.String
SCHEME
-
Constructor Summary
Constructors Constructor Description RelayUri()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
deviceId(java.lang.String id)
Creates a URN from a device ID.static java.lang.String
deviceName(java.lang.String name)
Creates a URN from a device name.static java.lang.String
groupId(java.lang.String id)
Creates a URN from a group ID.static java.lang.String
groupMember(java.lang.String group, java.lang.String device)
Creates a URN for a group member.static java.lang.String
groupName(java.lang.String name)
Creates a URN from a group name.static java.lang.String
interactionName(java.lang.String name)
Creates a URN from an interaction name.static boolean
isInteractionUri(java.lang.String uri)
Checks if the URN is for an interaction.static boolean
isRelayUri(java.lang.String uri)
Checks if the URN is a Relay URN.static java.lang.String
parseDeviceId(java.lang.String uri)
Parses out a device ID from a device or interaction URN.static java.lang.String
parseDeviceName(java.lang.String uri)
Parses out a device name from a device or interaction URN.static java.lang.String
parseGroupId(java.lang.String uri)
Parses out a group ID from a group URN.static java.lang.String
parseGroupName(java.lang.String uri)
Parses out a group name from a group URN.static java.lang.String
parseInteraction(java.lang.String uri)
Parses out the name of an interaction from an interaction URN.
-
-
-
Field Detail
-
SCHEME
public static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
ROOT
public static final java.lang.String ROOT
- See Also:
- Constant Field Values
-
GROUP
public static final java.lang.String GROUP
- See Also:
- Constant Field Values
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DEVICE
public static final java.lang.String DEVICE
- See Also:
- Constant Field Values
-
DEVICE_PATTERN
public static final java.lang.String DEVICE_PATTERN
- See Also:
- Constant Field Values
-
INTERACTION
public static final java.lang.String INTERACTION
- See Also:
- Constant Field Values
-
INTERACTION_URI_NAME
public static final java.lang.String INTERACTION_URI_NAME
- See Also:
- Constant Field Values
-
INTERACTION_URI_ID
public static final java.lang.String INTERACTION_URI_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
groupId
public static java.lang.String groupId(java.lang.String id)
Creates a URN from a group ID.- Parameters:
id
- the ID of the group.- Returns:
- the newly constructed URN.
-
groupName
public static java.lang.String groupName(java.lang.String name)
Creates a URN from a group name.- Parameters:
name
- the name of the group.- Returns:
- the newly constructed URN.
-
groupMember
public static java.lang.String groupMember(java.lang.String group, java.lang.String device)
Creates a URN for a group member.- Parameters:
group
- the name of the group that the device belongs to.device
- the newly constructed URN.- Returns:
-
deviceId
public static java.lang.String deviceId(java.lang.String id)
Creates a URN from a device ID.- Parameters:
id
- the ID of the device.- Returns:
- the newly constructed URN.
-
deviceName
public static java.lang.String deviceName(java.lang.String name)
Creates a URN from a device name.- Parameters:
name
- the name of the device.- Returns:
- the newly constructed URN.
-
interactionName
public static java.lang.String interactionName(java.lang.String name)
Creates a URN from an interaction name.- Parameters:
name
- the name of the interaction.- Returns:
- the newly constructed URN.
-
parseGroupName
public static java.lang.String parseGroupName(java.lang.String uri)
Parses out a group name from a group URN.- Parameters:
uri
- the URN that you would like to extract the group name from.- Returns:
-
parseGroupId
public static java.lang.String parseGroupId(java.lang.String uri)
Parses out a group ID from a group URN.- Parameters:
uri
- the URN that you would like to extract the group ID from.- Returns:
- the group ID.
-
parseDeviceName
public static java.lang.String parseDeviceName(java.lang.String uri)
Parses out a device name from a device or interaction URN.- Parameters:
uri
- the device or interaction URN that you would liek to extract the device name from.- Returns:
- the device name.
-
parseDeviceId
public static java.lang.String parseDeviceId(java.lang.String uri)
Parses out a device ID from a device or interaction URN.- Parameters:
uri
- the device or interaction URN that you would like to extract the device ID from.- Returns:
- the device ID.
-
parseInteraction
public static java.lang.String parseInteraction(java.lang.String uri)
Parses out the name of an interaction from an interaction URN.- Parameters:
uri
- the interaction URN that you would like to parse the interaction from.- Returns:
- the name of the interaction.
-
isInteractionUri
public static boolean isInteractionUri(java.lang.String uri)
Checks if the URN is for an interaction.- Parameters:
uri
- the device, group, or interaction URN.- Returns:
- true if the URN is a Relay URN, false otherwise.
-
isRelayUri
public static boolean isRelayUri(java.lang.String uri)
Checks if the URN is a Relay URN.- Parameters:
uri
- the device, group, or interaction URN.- Returns:
- true if the URN is a Relay URN, false otherwise.
-
-