java.lang.Object
de.powerstat.validation.values.IPV4Mask
- All Implemented Interfaces:
IValueObject
,Comparable<IPV4Mask>
IP V4 mask.
Not DSGVO relevant.
TODO IPV4Address filterMin(IPV4Address) 0
TODO IPV4Address filterMax(IPV4Address) 255
-
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 IPV4Mask as an int.private static int
maskToLength
(String mask) Calculate length from mask.static IPV4Mask
of
(int length) IPV4Mask factory.static IPV4Mask
IPV4Mask factory.Returns the value of this IPV4Mask as a string.toString()
Returns the string representation of this IPV4Address.
-
Field Details
-
ZERO
0.- See Also:
-
BITMASKS
Bitmask array. -
IPV4_MASK_REGEXP
IP V4 mask regexp. -
length
private final int lengthPrefix length. -
mask
Mask.
-
-
Constructor Details
-
IPV4Mask
private IPV4Mask(int length) Constructor.- Parameters:
length
- Prefix length (0-32)- Throws:
IndexOutOfBoundsException
- if the prefix length is < 0 or > 32
-
-
Method Details
-
maskToLength
Calculate length from mask.- Parameters:
mask
- Mask in the form like 255.255.255.0- Returns:
- Prefix length (0-32)
-
of
IPV4Mask factory.- Parameters:
length
- IP V4 prefix length 0-32- Returns:
- IPV4Mask object
-
of
IPV4Mask factory.- Parameters:
mask
- IP V4 network mask in format like 255.255.255.0- Returns:
- IPV4Mask object TODO mask=length as string (0-32)?
-
intValue
public int intValue()Returns the value of this IPV4Mask as an int.- Returns:
- The numeric value represented by this object after conversion to type int (0-32).
-
stringValue
Returns the value of this IPV4Mask as a string.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string of format 255.255.255.0.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this IPV4Address. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "IPV4Mask[length=24, mask=255.255.255.0]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<IPV4Mask>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-