java.lang.Object
de.powerstat.validation.values.Port
- All Implemented Interfaces:
IValueObject
,Comparable<Port>
Port.
Not DSGVO relevant.
TODO min, max?
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compare with another object.boolean
Is equal with another object.int
hashCode()
Calculate hash code.int
intValue()
Returns the value of this Port as an int.boolean
Is dynamic port (49152-65535).boolean
Is registered port (1024-49151).boolean
isSystem()
Is system port (0-1023).static Port
of
(int port) Port factory.static Port
Port factory.Returns the value of this Port as an String.toString()
Returns the string representation of this Port.
-
Field Details
-
port
private final int portPort.
-
-
Constructor Details
-
Port
private Port(int port) Constructor.- Parameters:
port
- Port 0-65535- Throws:
IndexOutOfBoundsException
- When the port is less than 0 or greater than 65535
-
-
Method Details
-
of
Port factory.- Parameters:
port
- Port 0-65535- Returns:
- Port object
-
of
Port factory.- Parameters:
port
- Port 0-65535- Returns:
- Port object
-
isSystem
public boolean isSystem()Is system port (0-1023).- Returns:
- true: system port, otherwise false
-
isRegistered
public boolean isRegistered()Is registered port (1024-49151).- Returns:
- true: registered port, otherwise false
-
isDynamic
public boolean isDynamic()Is dynamic port (49152-65535).- Returns:
- true: dynamic port, otherwise false
-
intValue
public int intValue()Returns the value of this Port as an int.- Returns:
- The numeric value represented by this object after conversion to type int.
-
stringValue
Returns the value of this Port as an String.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The numeric value represented by this object after conversion to type String.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this Port. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Port[port=0]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Port>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-