public class Vni extends Object implements Comparable<Vni>
All constructors for this class are private. Creating instances of
Vni
is done via the static methods on the class.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides equals(java.lang.Object)
and hashCode()
so that instances
play nicely with the Collection classes.
This class implements the Comparable
interface to ensure that
a sorted list of identifiers is presented in an intuitive order.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_VALUE
The maximum permissible value (16777215).
|
static int |
MIN_VALUE
The minimum permissible value (0).
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Vni o) |
boolean |
equals(Object o) |
int |
hashCode() |
int |
toInt()
Returns the Virtual Network Identifier represented as an integer.
|
String |
toString()
Returns a string representation of this Virtual Network Identifier, as
a decimal number.
|
static Vni |
valueOf(int value)
Returns a Virtual Network Identifier instance representing the
value given by the specified integer.
|
static Vni |
valueOf(String value)
Returns a Virtual Network Identifier instance representing the
value given by the specified string.
|
static Vni |
vni(int value)
A convenience method that simply delegates to
valueOf(int) . |
public static final int MAX_VALUE
public static final int MIN_VALUE
public String toString()
public int toInt()
public static Vni valueOf(int value)
value
- the valueIllegalArgumentException
- if value is not u24public static Vni vni(int value)
valueOf(int)
.
Included so that this method may be statically imported, such that it is easy to express VNIs in code:
import static com.hp.util.ip.Vni.vni; ... Vni v = vni(3);
value
- the valueIllegalArgumentException
- if value is not u24public static Vni valueOf(String value)
The following examples return a VNI of 23:
Vni v1 = Vni.valueOf("23"); Vni v2 = Vni.valueOf("0x17");
value
- a string representing a numberNullPointerException
- if value is nullIllegalArgumentException
- if value is not parsable as a u24 valuepublic int compareTo(Vni o)
compareTo
in interface Comparable<Vni>
Copyright © 2015. All Rights Reserved.