public final class GroupId extends U32Id implements Comparable<GroupId>
All constructors for this class are private.
Creating instances of GroupId
is done via the static
methods on the class.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides UnsignedLongBasedId.equals(java.lang.Object)
and UnsignedLongBasedId.hashCode()
so that
instances play nicely with the Collection classes.
This class implements the Comparable
interface to ensure that
a sorted list of group IDs is presented in an intuitive order.
Modifier and Type | Field and Description |
---|---|
static GroupId |
ALL
All groups, for group delete commands or group stats requests;
Since 1.1.
|
static GroupId |
ANY
Wildcard group used for flow stats requests; Since 1.1.
|
static GroupId |
MAX
Last usable group number; Since 1.1.
|
E_BYTES_BAD_LEN, LENGTH_IN_BYTES, MAX_VALUE
id
E_BAD, E_NULL_BYTES, E_NULL_STR, E_OOR, MIN_VALUE
Modifier and Type | Method and Description |
---|---|
int |
compareTo(GroupId o)
Implements the Comparable interface, to return group IDs in
natural order.
|
static GroupId |
gid(String s)
Convenience method that returns the group ID instance for the given
string representation.
|
String |
toString()
Returns a string representation of the group ID.
|
static GroupId |
valueOf(byte[] bytes)
Returns an object that represents the group identifier
defined by the specified byte array.
|
static GroupId |
valueOf(long gid)
Returns an object that represents the group ID defined by the
specified long.
|
static GroupId |
valueOf(String s)
Returns an object that represents the group ID defined by the
specified string.
|
rangeCheck, toByteArray
equals, hashCode, toLong
parseIntStr, parseLongStr
getRefQ, keyFromBytes
public static final GroupId MAX
public static final GroupId ALL
public static final GroupId ANY
public String toString()
toString
in class UnsignedLongBasedId
public int compareTo(GroupId o)
compareTo
in interface Comparable<GroupId>
o
- the other group IDComparable.compareTo(T)
public static GroupId valueOf(long gid)
gid
- the group ID expressed as a longIllegalArgumentException
- if the group ID is not u32public static GroupId valueOf(String s)
s
- the group ID as a stringIllegalArgumentException
- if the string is invalidNullPointerException
- if the string is nullpublic static GroupId gid(String s)
valueOf(String)
. By using a static import of this method, code
can be written more concisely. For example, the following two
statements are equivalent:
GroupId g = GroupId.valueOf("3"); GroupId g = gid("3");
s
- the group ID as a stringIllegalArgumentException
- if the string is invalidNullPointerException
- if the string is nullpublic static GroupId valueOf(byte[] bytes)
U32Id.LENGTH_IN_BYTES
bytes long.bytes
- the encoded idNullPointerException
- if the byte array is nullIllegalArgumentException
- if the byte array is not 4 bytes longCopyright © 2015. All Rights Reserved.