public class ChannelId extends Object
Reification of a channel id with methods to test properties
and compare with other ChannelIds.
A ChannelId breaks the channel id into path segments so that, for example,
/foo/bar breaks into ["foo","bar"].
ChannelId can be wild, when they end with one or two wild characters "*";
a ChannelId is shallow wild if it ends with one wild character (for example /foo/bar/*)
and deep wild if it ends with two wild characters (for example /foo/bar/**).
| Modifier and Type | Field and Description |
|---|---|
static String |
DEEPWILD |
static String |
WILD |
| Constructor and Description |
|---|
ChannelId(String id)
Constructs a new
ChannelId with the given id |
| Modifier and Type | Method and Description |
|---|---|
int |
depth() |
boolean |
equals(Object obj) |
String |
getParent() |
String |
getSegment(int i) |
List<String> |
getWilds() |
int |
hashCode() |
boolean |
isAncestorOf(ChannelId id) |
boolean |
isBroadcast() |
static boolean |
isBroadcast(String channelId)
Helper method to test if the string form of a
ChannelId
represents a isBroadcast() broadcast} ChannelId. |
boolean |
isDeepWild()
|
boolean |
isMeta()
A
ChannelId is a meta ChannelId if it starts with "/meta/". |
static boolean |
isMeta(String channelId)
|
boolean |
isParentOf(ChannelId id) |
boolean |
isService()
A
ChannelId is a service ChannelId if it starts with "/service/". |
static boolean |
isService(String channelId)
Helper method to test if the string form of a
ChannelId
represents a isService() service} ChannelId. |
boolean |
isShallowWild()
|
boolean |
isWild() |
boolean |
matches(ChannelId channelId)
Tests whether this
ChannelId matches the given ChannelId. |
String |
toString() |
public static final String WILD
public static final String DEEPWILD
public ChannelId(String id)
ChannelId with the given idid - the channel id in string formpublic boolean isWild()
ChannelId is either shallow wild
or deep wildpublic boolean isShallowWild()
Shallow wild ChannelIds end with a single wild character "*"
and match non wild channels with
the same depth.
Example: /foo/* matches /foo/bar, but not /foo/bar/baz.
ChannelId is a shallow wild channel idpublic boolean isDeepWild()
Deep wild ChannelIds end with a double wild character "**"
and match non wild channels with
the same or greater depth.
Example: /foo/** matches /foo/bar and /foo/bar/baz.
ChannelId is a deep wild channel idpublic boolean isMeta()
A ChannelId is a meta ChannelId if it starts with "/meta/".
public boolean isService()
A ChannelId is a service ChannelId if it starts with "/service/".
public boolean matches(ChannelId channelId)
Tests whether this ChannelId matches the given ChannelId.
If the given ChannelId is wild,
then it matches only if it is equal to this ChannelId.
If this ChannelId is non-wild,
then it matches only if it is equal to the given ChannelId.
Otherwise, this ChannelId is either shallow or deep wild, and
matches ChannelIds with the same number of equal segments (if it is
shallow wild), or ChannelIds with the same or a greater number of
equal segments (if it is deep wild).
channelId - the channelId to matchChannelId matches the given ChannelIdpublic int depth()
ChannelId is made ofgetSegment(int)public boolean isAncestorOf(ChannelId id)
id - the channel to testChannelId is an ancestor of the given ChannelIdisParentOf(ChannelId)public boolean isParentOf(ChannelId id)
id - the channel to testChannelId is the parent of the given ChannelIdisAncestorOf(ChannelId)public String getParent()
ChannelId parent of this ChannelIdisParentOf(ChannelId)public String getSegment(int i)
i - the segment indexdepth()public List<String> getWilds()
public static boolean isMeta(String channelId)
Helper method to test if the string form of a ChannelId
represents a meta ChannelId.
channelId - the channel id to testpublic static boolean isService(String channelId)
Helper method to test if the string form of a ChannelId
represents a isService() service} ChannelId.
channelId - the channel id to testpublic static boolean isBroadcast(String channelId)
Helper method to test if the string form of a ChannelId
represents a isBroadcast() broadcast} ChannelId.
channelId - the channel id to testCopyright © 2008-2012 Dojo Foundation. All Rights Reserved.