Class IPV4Address

java.lang.Object
de.powerstat.validation.values.IPV4Address
All Implemented Interfaces:
IValueObject, Comparable<IPV4Address>

public final class IPV4Address extends Object implements Comparable<IPV4Address>, IValueObject
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
    Modifier and Type
    Field
    Description
    private final String
    IP V4 address.
    private static final String
    100.
    private static final String
    198.
    private static final String
    Class c 192.
    private static final Pattern
    IP V4 regexp.
    private final String[]
    IP V4 address parts.
    private static final String
    0.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compare with another object.
    boolean
    Is equal with another object.
    int
    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 3927
    boolean
    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 922
    of(String address)
    IPV4Address factory.
    Returns the value of this IPV4Address as a string.
    Returns the string representation of this IPV4Address.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • of

      public static IPV4Address of(String address)
      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

      public String stringValue()
      Returns the value of this IPV4Address as a string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String 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]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this IPV4Address
      See Also:
    • compareTo

      public int compareTo(IPV4Address obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<IPV4Address>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also: