java.lang.Object
de.powerstat.validation.values.IPV4Address
- All Implemented Interfaces:
IValueObject
,Comparable<IPV4Address>
IP V4 address.
DSGVO relevant.
TODO convert to IP V6 format
TODO https://datahub.io/core/geoip2-ipv4/r/geoip2-ipv4.csv
TODO ping ok?
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(IPV4Address obj) Compare with another object.boolean
Is equal with another object.int
hashCode()
Calculate hash code.boolean
Is an IP V4 private address. 10.0.0.0–10.255.255.255 private, 1 8-Bit-Net 10.0.0.0/8 RFC 1918 172.16.0.0–172.31.255.255 private, 16 16-Bit-Nets 172.16.0.0/12 RFC 1918 192.168.0.0–192.168.255.255 private, 256 24-Bit-Nets 192.168.0.0/16 RFC 1918 169.254.0.0–169.254.255.255 link local, 1 16-Bit-Net 169.254.0.0/16 RFC 3927boolean
isPublic()
Is an IP V4 public address.boolean
Is an IP V4 special address. 0.0.0.0/8 Das vorliegende Netzwerk RFC 1122 127.0.0.0/8 Loopback RFC 1122 100.64.0.0/10 Shared Transition Space RFC 6598 192.0.0.0/24 IETF Protocol Assignments RFC 6890 192.0.2.0/24 Test-Netzwerke RFC 6890 192.88.99.0/24 IPv6 zu IPv4 Relay (Veraltet) RFC 7526 198.18.0.0/15 Netzwerk-Benchmark-Tests RFC 2544 198.51.100.0/24 Test-Netzwerke RFC 6890 203.0.113.0/24 Test-Netzwerke RFC 6890 224.0.0.0/4 Multicasts RFC 5771 240.0.0.0/4 Reserviert RFC 1700 255.255.255.255/32 Limited Broadcast RFC 919, RFC 922static IPV4Address
IPV4Address factory.Returns the value of this IPV4Address as a string.toString()
Returns the string representation of this IPV4Address.
-
Field Details
-
CLASS_C_192
Class c 192.- See Also:
-
C100
100.- See Also:
-
C198
198.- See Also:
-
ZERO
0.- See Also:
-
IPV4_REGEXP
IP V4 regexp. -
address
IP V4 address. -
parts
IP V4 address parts.
-
-
Constructor Details
-
IPV4Address
Constructor.- Parameters:
address
- IP V4 address- Throws:
NullPointerException
- if address is nullIllegalArgumentException
- if address is not an ip v4 address
-
-
Method Details
-
of
IPV4Address factory.- Parameters:
address
- IP V4 address- Returns:
- IPV4Address object
-
isPrivate
public boolean isPrivate()Is an IP V4 private address. 10.0.0.0–10.255.255.255 private, 1 8-Bit-Net 10.0.0.0/8 RFC 1918 172.16.0.0–172.31.255.255 private, 16 16-Bit-Nets 172.16.0.0/12 RFC 1918 192.168.0.0–192.168.255.255 private, 256 24-Bit-Nets 192.168.0.0/16 RFC 1918 169.254.0.0–169.254.255.255 link local, 1 16-Bit-Net 169.254.0.0/16 RFC 3927- Returns:
- true when private address, otherwise false
-
isSpecial
public boolean isSpecial()Is an IP V4 special address. 0.0.0.0/8 Das vorliegende Netzwerk RFC 1122 127.0.0.0/8 Loopback RFC 1122 100.64.0.0/10 Shared Transition Space RFC 6598 192.0.0.0/24 IETF Protocol Assignments RFC 6890 192.0.2.0/24 Test-Netzwerke RFC 6890 192.88.99.0/24 IPv6 zu IPv4 Relay (Veraltet) RFC 7526 198.18.0.0/15 Netzwerk-Benchmark-Tests RFC 2544 198.51.100.0/24 Test-Netzwerke RFC 6890 203.0.113.0/24 Test-Netzwerke RFC 6890 224.0.0.0/4 Multicasts RFC 5771 240.0.0.0/4 Reserviert RFC 1700 255.255.255.255/32 Limited Broadcast RFC 919, RFC 922- Returns:
- true when special address, otherwise false
-
isPublic
public boolean isPublic()Is an IP V4 public address.- Returns:
- true when public address, otherwise false
-
stringValue
Returns the value of this IPV4Address as a string.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text 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 IPV4Address. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "IPV4Address[address=192.168.0.0]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<IPV4Address>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-