Package org.onosproject.net
Class PortNumber
- java.lang.Object
-
- org.onosproject.net.PortNumber
-
public final class PortNumber extends java.lang.Object
Representation of a port number.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PortNumber.Logical
Logical PortNumbers.
-
Field Summary
Fields Modifier and Type Field Description static PortNumber
ALL
static PortNumber
ANY
static PortNumber
CONTROLLER
static PortNumber
FLOOD
static PortNumber
IN_PORT
static PortNumber
LOCAL
static long
NO_DISPLAY_NUMBER
static PortNumber
NORMAL
static PortNumber
P0
static PortNumber
TABLE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
boolean
exactlyEquals(PortNumber that)
Indicates whether some other PortNumber object is equal to this one including it's name.static PortNumber
fromString(java.lang.String s)
Returns PortNumber instance from String representation.int
hashCode()
boolean
hasName()
Indicates whether this port number was created with a port name, or only with a number.boolean
isLogical()
Indicates whether or not this port number is a reserved logical one or whether it corresponds to a normal physical port of a device or NIC.java.lang.String
name()
Returns the backing string value.static PortNumber
portNumber(long number)
Returns the port number representing the specified long value.static PortNumber
portNumber(long number, java.lang.String name)
Returns the port number representing the specified long value and name.static PortNumber
portNumber(java.lang.String string)
Returns the port number representing the specified string value.long
toLong()
Returns the backing long value.java.lang.String
toString()
-
-
-
Field Detail
-
P0
public static final PortNumber P0
-
NO_DISPLAY_NUMBER
public static final long NO_DISPLAY_NUMBER
- See Also:
- Constant Field Values
-
IN_PORT
public static final PortNumber IN_PORT
-
TABLE
public static final PortNumber TABLE
-
NORMAL
public static final PortNumber NORMAL
-
FLOOD
public static final PortNumber FLOOD
-
ALL
public static final PortNumber ALL
-
LOCAL
public static final PortNumber LOCAL
-
CONTROLLER
public static final PortNumber CONTROLLER
-
ANY
public static final PortNumber ANY
-
-
Method Detail
-
portNumber
public static PortNumber portNumber(long number)
Returns the port number representing the specified long value.- Parameters:
number
- port number as long value- Returns:
- port number
-
portNumber
public static PortNumber portNumber(java.lang.String string)
Returns the port number representing the specified string value.- Parameters:
string
- port number as decimal, hexadecimal, or octal number string- Returns:
- port number
-
portNumber
public static PortNumber portNumber(long number, java.lang.String name)
Returns the port number representing the specified long value and name.- Parameters:
number
- port number as long valuename
- port name as string value- Returns:
- port number
-
fromString
public static PortNumber fromString(java.lang.String s)
Returns PortNumber instance from String representation.- Parameters:
s
- String representation equivalent totoString()
- Returns:
PortNumber
instance- Throws:
java.lang.IllegalArgumentException
- if given String was malformed
-
isLogical
public boolean isLogical()
Indicates whether or not this port number is a reserved logical one or whether it corresponds to a normal physical port of a device or NIC.- Returns:
- true if logical port number
-
toLong
public long toLong()
Returns the backing long value.- Returns:
- port number as long
-
name
public java.lang.String name()
Returns the backing string value.- Returns:
- port name as string value
-
hasName
public boolean hasName()
Indicates whether this port number was created with a port name, or only with a number.- Returns:
- true if port was created with name
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
exactlyEquals
public boolean exactlyEquals(PortNumber that)
Indicates whether some other PortNumber object is equal to this one including it's name.- Parameters:
that
- otherPortNumber
instance to compare- Returns:
- true if equal, false otherwise
-
-